automated-invoice-processing-agent-backend / src /db /migrations /20240710113255-create-user-table.js
abhishek-akbari01
add new fields in user modal
64ebbd0
'use strict';
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.createTable('users', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
name: {
type: Sequelize.STRING,
allowNull: false
},
email: {
type: Sequelize.STRING,
allowNull: false,
unique: true
},
role_id: {
type: Sequelize.INTEGER,
allowNull: false,
references: {
model: 'roles',
key: 'id'
},
onUpdate: 'CASCADE',
onDelete: 'CASCADE'
},
status: {
type: Sequelize.STRING,
allowNull: false
},
password: {
type: Sequelize.STRING,
allowNull: false
},
reset_token: {
type: Sequelize.STRING,
allowNull: true,
},
reset_token_expiry: {
type: Sequelize.DATE,
allowNull: true,
},
created_at: {
type: Sequelize.DATE
},
updated_at: {
type: Sequelize.DATE
},
deleted_at: {
type: Sequelize.DATE,
allowNull: true
}
});
},
async down(queryInterface, Sequelize) {
await queryInterface.dropTable('users');
}
};