'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'); }, };