Skip to content

Instantly share code, notes, and snippets.

@bbachi
Created February 4, 2023 23:05
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 bbachi/1baecb0a5bf81bfe78aa7a5dff751f72 to your computer and use it in GitHub Desktop.
Save bbachi/1baecb0a5bf81bfe78aa7a5dff751f72 to your computer and use it in GitHub Desktop.
MYSQL
module.exports = (sequelize, DataTypes, Model) => {
class Tasks extends Model {}
Tasks.init({
// Model attributes are defined here
name: {
type: DataTypes.STRING,
allowNull: false
},
description: {
type: DataTypes.STRING
// allowNull defaults to true
},
createdAt: {
type: DataTypes.DATE
// allowNull defaults to true
},
updatedAt: {
type: DataTypes.DATE
// allowNull defaults to true
},
createdby: {
type: DataTypes.STRING,
allowNull: false
},
updatedby: {
type: DataTypes.STRING
// allowNull defaults to true
},
}, {
// Other model options go here
sequelize, // We need to pass the connection instance
modelName: 'tasks' // We need to choose the model name
});
return Tasks;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment