mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
27 lines
1.2 KiB
JavaScript
27 lines
1.2 KiB
JavaScript
'use strict';
|
|
|
|
module.exports = {
|
|
async up(queryInterface, Sequelize) {
|
|
await queryInterface.createTable('user_sessions', {
|
|
session_id: { type: Sequelize.BIGINT, primaryKey: true, autoIncrement: true },
|
|
user_id: { type: Sequelize.BIGINT, allowNull: false, references: { model: 'users', key: 'user_id' }, onUpdate: 'CASCADE', onDelete: 'CASCADE' },
|
|
login_info: { type: Sequelize.JSONB, allowNull: true },
|
|
logout_info: { type: Sequelize.JSONB, allowNull: true },
|
|
refresh_token_hash: { type: Sequelize.TEXT, allowNull: true },
|
|
is_active: { type: Sequelize.BOOLEAN, defaultValue: true },
|
|
createdBy: { type: Sequelize.BIGINT, allowNull: true },
|
|
updatedBy: { type: Sequelize.BIGINT, allowNull: true },
|
|
deletedBy: { type: Sequelize.BIGINT, allowNull: true },
|
|
createdAt: { type: Sequelize.DATE, allowNull: false },
|
|
updatedAt: { type: Sequelize.DATE, allowNull: false },
|
|
deletedAt: { type: Sequelize.DATE, allowNull: true },
|
|
});
|
|
|
|
await queryInterface.addIndex('user_sessions', ['user_id']);
|
|
},
|
|
|
|
async down(queryInterface) {
|
|
await queryInterface.dropTable('user_sessions');
|
|
},
|
|
};
|