assets and tier plans revamp

Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
2026-08-01 17:44:25 +08:00
parent 39c3c4566b
commit cae958b5d5
41 changed files with 1271 additions and 165 deletions
@@ -0,0 +1,43 @@
'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');
},
};