add changes
This commit is contained in:
61
migrations/20251112000000-create-guest-settings.js
Normal file
61
migrations/20251112000000-create-guest-settings.js
Normal file
@@ -0,0 +1,61 @@
|
||||
'use strict';
|
||||
|
||||
/** @type {import('sequelize-cli').Migration} */
|
||||
module.exports = {
|
||||
async up (queryInterface, Sequelize) {
|
||||
console.log('Creating guest_settings table...');
|
||||
|
||||
await queryInterface.createTable('guest_settings', {
|
||||
id: {
|
||||
type: Sequelize.CHAR(36),
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
comment: 'UUID primary key'
|
||||
},
|
||||
max_quizzes: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false,
|
||||
defaultValue: 3,
|
||||
comment: 'Maximum number of quizzes a guest can take'
|
||||
},
|
||||
expiry_hours: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false,
|
||||
defaultValue: 24,
|
||||
comment: 'Guest session expiry time in hours'
|
||||
},
|
||||
public_categories: {
|
||||
type: Sequelize.JSON,
|
||||
allowNull: false,
|
||||
defaultValue: '[]',
|
||||
comment: 'Array of category UUIDs accessible to guests'
|
||||
},
|
||||
feature_restrictions: {
|
||||
type: Sequelize.JSON,
|
||||
allowNull: false,
|
||||
defaultValue: '{"allowBookmarks":false,"allowReview":true,"allowPracticeMode":true,"allowTimedMode":false,"allowExamMode":false}',
|
||||
comment: 'Feature restrictions for guest users'
|
||||
},
|
||||
created_at: {
|
||||
type: Sequelize.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP')
|
||||
},
|
||||
updated_at: {
|
||||
type: Sequelize.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP')
|
||||
}
|
||||
}, {
|
||||
comment: 'System-wide guest user settings'
|
||||
});
|
||||
|
||||
console.log('✅ guest_settings table created successfully');
|
||||
},
|
||||
|
||||
async down (queryInterface, Sequelize) {
|
||||
console.log('Dropping guest_settings table...');
|
||||
await queryInterface.dropTable('guest_settings');
|
||||
console.log('✅ guest_settings table dropped successfully');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user