Created
February 4, 2023 23:05
-
-
Save bbachi/1baecb0a5bf81bfe78aa7a5dff751f72 to your computer and use it in GitHub Desktop.
MYSQL
This file contains 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
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