hooks como foreignkey
This commit is contained in:
@@ -16,14 +16,6 @@ Reporte.init(
|
||||
type: DataTypes.STRING(100),
|
||||
allowNull: false,
|
||||
},
|
||||
idPrestamo: {
|
||||
type: DataTypes.INTEGER,
|
||||
references: {
|
||||
model: Prestamo,
|
||||
key: 'idPrestamo',
|
||||
},
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
@@ -32,4 +24,8 @@ Reporte.init(
|
||||
}
|
||||
)
|
||||
|
||||
Reporte.belongsTo(Prestamo, {
|
||||
foreignKey: { name: 'idPrestamo', type: DataTypes.INTEGER, allowNull: false },
|
||||
})
|
||||
|
||||
module.exports = Reporte
|
||||
|
||||
Reference in New Issue
Block a user