@tomei/sso
Version:
Tomei SSO Package
125 lines (122 loc) • 2.85 kB
JavaScript
'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.createTable('sso_User', {
UserId: {
primaryKey: true,
type: Sequelize.INTEGER,
allowNull: false,
autoIncrement: true,
},
UserName: {
type: Sequelize.STRING(50),
allowNull: true,
},
Email: {
type: Sequelize.STRING,
allowNull: false,
unique: true,
},
Password: {
type: Sequelize.STRING,
allowNull: false,
},
FullName: {
type: Sequelize.STRING(200),
allowNull: true,
},
IdNo: {
type: Sequelize.STRING(50),
allowNull: true,
},
IdType: {
type: Sequelize.STRING(20),
allowNull: true,
},
ContactNo: {
type: Sequelize.STRING(20),
allowNull: true,
},
Status: {
type: Sequelize.STRING,
allowNull: false,
},
DefaultPasswordChangedYN: {
type: Sequelize.CHAR(1),
allowNull: true,
},
FirstLoginAt: {
type: Sequelize.DATE,
allowNull: true,
},
LastLoginAt: {
type: Sequelize.DATE,
allowNull: true,
},
MFAEnabled: {
type: Sequelize.TINYINT,
allowNull: true,
},
MFAConfig: {
type: Sequelize.TEXT,
allowNull: true,
},
RecoveryEmail: {
type: Sequelize.STRING,
allowNull: true,
},
FailedLoginAttemptCount: {
type: Sequelize.INTEGER,
allowNull: false,
},
LastFailedLoginAt: {
type: Sequelize.DATE,
allowNull: true,
},
LastPasswordChangedAt: {
type: Sequelize.DATE,
allowNull: true,
},
NeedToChangePasswordYN: {
type: Sequelize.CHAR(1),
allowNull: true,
},
CreatedAt: {
allowNull: false,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'),
type: Sequelize.DATE,
},
CreatedById: {
type: Sequelize.INTEGER,
allowNull: true,
references: {
model: 'sso_User',
key: 'UserId',
},
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
},
UpdatedAt: {
allowNull: false,
defaultValue: Sequelize.literal(
'CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)',
),
type: Sequelize.DATE,
},
UpdatedById: {
type: Sequelize.INTEGER,
allowNull: true,
references: {
model: 'sso_User',
key: 'UserId',
},
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
},
});
},
async down(queryInterface) {
await queryInterface.dropTable('sso_User');
},
};