Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created July 30, 2020 04:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/5afbf40cc39a274a7eec799641511b4e to your computer and use it in GitHub Desktop.
Save parzibyte/5afbf40cc39a274a7eec799641511b4e to your computer and use it in GitHub Desktop.
// 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