'use strict'; // Tracks background container-remux jobs for video assets uploaded as .mov/ // .mkv — those formats often load slowly in-browser (moov/Cues index at the // end of the file) compared to faststart .mp4. See services/ffmpeg.service.js // + services/assetTranscode.service.js. // // STRING + explicit CHECK instead of a real ENUM — same CockroachDB // constraint noted in 20270101000032-create-advertisements.js (addColumn // can't create a new enum type the way createTable can). module.exports = { async up(queryInterface, Sequelize) { await queryInterface.addColumn('assets', 'transcode_status', { type: Sequelize.STRING(20), allowNull: false, defaultValue: 'none', }); await queryInterface.addColumn('assets', 'transcode_error', { type: Sequelize.TEXT, allowNull: true, }); await queryInterface.addConstraint('assets', { fields: ['transcode_status'], type: 'check', name: 'check_assets_transcode_status', where: { transcode_status: { [Sequelize.Op.in]: ['none', 'pending', 'processing', 'done', 'failed'] } }, }); await queryInterface.sequelize.query(` CREATE INDEX idx_assets_transcode_status ON assets (transcode_status) WHERE transcode_status IN ('pending', 'processing'); `); }, async down(queryInterface) { await queryInterface.removeConstraint('assets', 'check_assets_transcode_status'); await queryInterface.removeColumn('assets', 'transcode_status'); await queryInterface.removeColumn('assets', 'transcode_error'); }, };