correcciones y nueva base
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const { DataTypes, Model } = require('sequelize');
|
||||
const sequelize = require('../../config/sequelize.conf');
|
||||
const Premiacion = require('./Premiacion');
|
||||
const Profesor = require('./Profesor');
|
||||
|
||||
class Invitado extends Model {}
|
||||
@@ -37,4 +38,12 @@ Invitado.belongsTo(Profesor, {
|
||||
},
|
||||
});
|
||||
|
||||
Invitado.belongsTo(Premiacion, {
|
||||
foreignKey: {
|
||||
name: 'idPremiacion',
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = Invitado;
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
const { DataTypes, Model } = require('sequelize');
|
||||
const sequelize = require('../../config/sequelize.conf');
|
||||
|
||||
class Premiacion extends Model {}
|
||||
Premiacion.init(
|
||||
{
|
||||
idPremiacion: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
autoIncrement: true,
|
||||
},
|
||||
premiacion: {
|
||||
type: DataTypes.STRING(50),
|
||||
allowNull: false,
|
||||
},
|
||||
fecha: {
|
||||
type: DataTypes.DATEONLY,
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'Premiacion',
|
||||
tableName: 'premiacion',
|
||||
timestamps: false,
|
||||
}
|
||||
);
|
||||
|
||||
module.exports = Premiacion;
|
||||
Reference in New Issue
Block a user