64 lines
1.5 KiB
JavaScript
64 lines
1.5 KiB
JavaScript
|
'use strict';
|
||
|
|
||
|
/** @type {import('sequelize-cli').Migration} */
|
||
|
module.exports = {
|
||
|
async up(queryInterface, Sequelize) {
|
||
|
await queryInterface.createTable('users', {
|
||
|
id: {
|
||
|
type: Sequelize.DataTypes.INTEGER,
|
||
|
autoIncrement: true,
|
||
|
primaryKey: true,
|
||
|
},
|
||
|
username: {
|
||
|
type: Sequelize.DataTypes.STRING,
|
||
|
allowNull: false,
|
||
|
unique: true,
|
||
|
},
|
||
|
email: {
|
||
|
type: Sequelize.DataTypes.STRING,
|
||
|
allowNull: true,
|
||
|
unique: true,
|
||
|
validate: {
|
||
|
isEmail: true,
|
||
|
},
|
||
|
},
|
||
|
password: {
|
||
|
type: Sequelize.DataTypes.STRING,
|
||
|
allowNull: false,
|
||
|
},
|
||
|
strategy: {
|
||
|
type: Sequelize.DataTypes.STRING,
|
||
|
allowNull: false,
|
||
|
defaultValue: 'local',
|
||
|
},
|
||
|
identifier: {
|
||
|
type: Sequelize.DataTypes.STRING,
|
||
|
allowNull: true,
|
||
|
},
|
||
|
active: {
|
||
|
type: Sequelize.DataTypes.BOOLEAN,
|
||
|
allowNull: false,
|
||
|
defaultValue: true,
|
||
|
},
|
||
|
createdAt: {
|
||
|
type: Sequelize.DataTypes.DATE,
|
||
|
allowNull: false,
|
||
|
defaultValue: Sequelize.DataTypes.NOW,
|
||
|
},
|
||
|
updatedAt: {
|
||
|
type: Sequelize.DataTypes.DATE,
|
||
|
allowNull: false,
|
||
|
defaultValue: Sequelize.DataTypes.NOW,
|
||
|
},
|
||
|
deletedAt: {
|
||
|
type: Sequelize.DataTypes.DATE,
|
||
|
allowNull: true,
|
||
|
},
|
||
|
});
|
||
|
},
|
||
|
|
||
|
async down(queryInterface) {
|
||
|
await queryInterface.dropTable('users');
|
||
|
},
|
||
|
};
|