Files
starr-philproperties/apps/api/database/migrations/20270101000038-create-task-completion-files.js
T

28 lines
1.3 KiB
JavaScript

'use strict';
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.createTable('task_completion_files', {
file_id: { type: Sequelize.UUID, defaultValue: Sequelize.UUIDV4, primaryKey: true },
completion_id: { type: Sequelize.UUID, allowNull: false, references: { model: 'task_completions', key: 'completion_id' }, onDelete: 'CASCADE' },
file_url: { type: Sequelize.STRING, allowNull: false },
file_name: { type: Sequelize.STRING, allowNull: false },
file_size: { type: Sequelize.INTEGER, allowNull: true },
mime_type: { type: Sequelize.STRING, allowNull: true },
storage_key: { type: Sequelize.STRING(500), allowNull: 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('task_completion_files', { fields: ['completion_id'], name: 'idx_tcf_completion_id' });
},
async down(queryInterface) {
await queryInterface.dropTable('task_completion_files');
},
};