Files
gnommoeditor/backend/migrations/013_create_transcripts.cjs

17 lines
887 B
JavaScript

// Word-level speech-to-text transcripts from narration_combined.transcript.json.
// Stored as a jsonb array [{word, start, end}] per source to avoid millions of tiny rows.
exports.up = (pgm) => {
pgm.createTable('transcripts', {
id: 'id',
project_id: { type: 'integer', notNull: true, references: 'videos', onDelete: 'CASCADE' },
source_name: { type: 'varchar(100)', notNull: true }, // narration_combined | talkinghead
words: { type: 'jsonb', notNull: true }, // [{word, start, end}, ...]
created_at: { type: 'timestamptz', notNull: true, default: pgm.func('NOW()') },
updated_at: { type: 'timestamptz', notNull: true, default: pgm.func('NOW()') },
});
pgm.addConstraint('transcripts', 'transcripts_project_source_unique',
'UNIQUE (project_id, source_name)');
};
exports.down = (pgm) => { pgm.dropTable('transcripts'); };