Created
July 30, 2020 04:42
-
-
Save parzibyte/5afbf40cc39a274a7eec799641511b4e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Definimos nuestro modelo | |
class Trabajador extends Model { } | |
Trabajador.init( | |
{ | |
// Los campos del modelo: | |
nombre: DataTypes.STRING, | |
}, | |
{ | |
sequelize: sequelize, | |
modelName: "trabajadores" | |
}); | |
// El trabajador pertenece a una oficina | |
Trabajador.Oficina = Trabajador.belongsTo(Oficina); | |
// Y lo exportamos | |
module.exports = Trabajador; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment