mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
31 lines
1.4 KiB
JavaScript
31 lines
1.4 KiB
JavaScript
'use strict';
|
|
|
|
// units no longer holds a direct course_id / order_index — the junction
|
|
// revamp (originally 20260707000001) moved course<->unit attachment (and its
|
|
// ordering) onto course_units, so units can now be standalone.
|
|
module.exports = {
|
|
async up(queryInterface, Sequelize) {
|
|
await queryInterface.createTable('units', {
|
|
unit_id: { type: Sequelize.BIGINT, primaryKey: true, autoIncrement: true },
|
|
uuid: { type: Sequelize.UUID, defaultValue: Sequelize.UUIDV4, allowNull: false, unique: true },
|
|
title: { type: Sequelize.STRING(255), allowNull: false },
|
|
subscription: { type: Sequelize.STRING(50), allowNull: true },
|
|
description: { type: Sequelize.TEXT, allowNull: true },
|
|
duration_seconds: { type: Sequelize.INTEGER, allowNull: true, defaultValue: 0 },
|
|
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('units', ['uuid']);
|
|
await queryInterface.addIndex('units', ['deletedAt']);
|
|
},
|
|
|
|
async down(queryInterface) {
|
|
await queryInterface.dropTable('units');
|
|
},
|
|
};
|