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>
22 lines
859 B
JavaScript
22 lines
859 B
JavaScript
'use strict';
|
|
|
|
module.exports = {
|
|
async up(queryInterface, Sequelize) {
|
|
await queryInterface.createTable('quiz_options', {
|
|
option_id: { type: Sequelize.BIGINT, primaryKey: true, autoIncrement: true },
|
|
question_id: { type: Sequelize.BIGINT, allowNull: false, references: { model: 'quiz_questions', key: 'question_id' }, onDelete: 'CASCADE' },
|
|
text: { type: Sequelize.TEXT, allowNull: false },
|
|
is_correct: { type: Sequelize.BOOLEAN, defaultValue: false },
|
|
order_index: { type: Sequelize.INTEGER, defaultValue: 0 },
|
|
createdAt: { type: Sequelize.DATE, allowNull: false },
|
|
updatedAt: { type: Sequelize.DATE, allowNull: false },
|
|
});
|
|
|
|
await queryInterface.addIndex('quiz_options', ['question_id']);
|
|
},
|
|
|
|
async down(queryInterface) {
|
|
await queryInterface.dropTable('quiz_options');
|
|
},
|
|
};
|