hooks como foreignkey

This commit is contained in:
2020-10-01 10:14:38 -05:00
parent 886ec20eaa
commit 0df256dcac
10 changed files with 126 additions and 160 deletions
+4 -8
View File
@@ -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