ready to test
Testing Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
async up(queryInterface, Sequelize) {
|
||||
await queryInterface.createTable('quiz_attempts', {
|
||||
attempt_id: { type: Sequelize.BIGINT, primaryKey: true, autoIncrement: true },
|
||||
uuid: { type: Sequelize.UUID, defaultValue: Sequelize.UUIDV4, unique: true },
|
||||
user_id: { type: Sequelize.BIGINT, allowNull: false, references: { model: 'users', key: 'user_id' }, onDelete: 'CASCADE' },
|
||||
quiz_id: { type: Sequelize.BIGINT, allowNull: true, references: { model: 'unit_quizzes', key: 'quiz_id' }, onDelete: 'SET NULL' },
|
||||
assessment_id: { type: Sequelize.BIGINT, allowNull: true, references: { model: 'course_assessments', key: 'assessment_id' }, onDelete: 'SET NULL' },
|
||||
answers: { type: Sequelize.JSONB, allowNull: false, defaultValue: {} },
|
||||
total_points: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 },
|
||||
earned_points: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 },
|
||||
score: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 },
|
||||
passed: { type: Sequelize.BOOLEAN, allowNull: false, defaultValue: false },
|
||||
createdAt: { type: Sequelize.DATE, allowNull: false },
|
||||
updatedAt: { type: Sequelize.DATE, allowNull: false },
|
||||
});
|
||||
|
||||
await queryInterface.addIndex('quiz_attempts', ['user_id']);
|
||||
await queryInterface.addIndex('quiz_attempts', ['quiz_id']);
|
||||
await queryInterface.addIndex('quiz_attempts', ['assessment_id']);
|
||||
},
|
||||
|
||||
async down(queryInterface) {
|
||||
await queryInterface.dropTable('quiz_attempts');
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user