Files
gnommoeditor/backend/migrations/008_create_audio_tracks.cjs

23 lines
1.2 KiB
JavaScript

// Background audio tracks from media/audio/audio.json.
// minio_object_key is null today; populated when audio files migrate to MinIO.
exports.up = (pgm) => {
pgm.createTable('audio_tracks', {
id: 'id',
project_id: { type: 'integer', notNull: true, references: 'videos', onDelete: 'CASCADE' },
track_key: { type: 'varchar(100)', notNull: true }, // cosmicpad, etc.
source_file: { type: 'varchar(500)' },
minio_object_key: { type: 'varchar(500)' },
volume: { type: 'numeric', notNull: true, default: 1.0 },
loop: { type: 'boolean', notNull: true, default: false },
overlap: { type: 'varchar(20)' }, // "15s"
ignore_pauses: { type: 'boolean', notNull: true, default: false },
duration_seconds: { type: 'numeric' },
created_at: { type: 'timestamptz', notNull: true, default: pgm.func('NOW()') },
updated_at: { type: 'timestamptz', notNull: true, default: pgm.func('NOW()') },
});
pgm.addConstraint('audio_tracks', 'audio_tracks_project_key_unique',
'UNIQUE (project_id, track_key)');
};
exports.down = (pgm) => { pgm.dropTable('audio_tracks'); };