47 lines
937 B
JavaScript
47 lines
937 B
JavaScript
const { DataTypes, Model } = require('sequelize');
|
|
const sequelize = require('../../config/sequelize.conf');
|
|
const Carrera = require('./Carrera');
|
|
const Periodo = require('./Periodo');
|
|
|
|
class CarreraPeriodo extends Model {}
|
|
CarreraPeriodo.init(
|
|
{
|
|
idCarreraPeriodo: {
|
|
type: DataTypes.INTEGER,
|
|
primaryKey: true,
|
|
allowNull: false,
|
|
unique: true,
|
|
autoIncrement: true,
|
|
},
|
|
vistoBueno: {
|
|
type: DataTypes.BOOLEAN,
|
|
allowNull: true,
|
|
defaultValue: false
|
|
}
|
|
},
|
|
{
|
|
sequelize,
|
|
modelName: 'CarreraPeriodo',
|
|
tableName: 'carrera_periodo',
|
|
timestamps: false,
|
|
}
|
|
);
|
|
|
|
CarreraPeriodo.belongsTo(Carrera, {
|
|
foreignKey: {
|
|
name: 'idCarrera',
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
},
|
|
});
|
|
|
|
CarreraPeriodo.belongsTo(Periodo, {
|
|
foreignKey: {
|
|
name: 'idPeriodo',
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
},
|
|
});
|
|
|
|
module.exports = CarreraPeriodo;
|