@tomei/sso
Version:
Tomei SSO Package
77 lines (74 loc) • 1.87 kB
JavaScript
'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.createTable('sso_UserPrivilege', {
UserPrivilegeId: {
primaryKey: true,
type: Sequelize.INTEGER,
allowNull: false,
autoIncrement: true,
},
UserId: {
type: Sequelize.INTEGER,
allowNull: true,
references: {
model: 'sso_User',
key: 'UserId',
},
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
},
SystemPrivilegeId: {
type: Sequelize.STRING(50),
allowNull: false,
references: {
model: 'sso_SystemPrivilege',
key: 'SystemPrivilegeId',
},
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
},
Status: {
type: Sequelize.STRING(10),
defaultValue: 'Active',
allowNull: false,
},
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_UserPrivilege');
},
};