Files
gnommoeditor/backend/migrations/004_create_cutouts.cjs
T

20 lines
1.1 KiB
JavaScript

// Cutout definitions from project.json "cutouts" section.
// A cutout is a named viewport region (talkinghead, square, fullscreen, fullscreen2).
// x/y/width/height are stored as strings because gnommo uses both "%" and raw values.
exports.up = (pgm) => {
pgm.createTable('cutouts', {
id: 'id',
project_id: { type: 'integer', notNull: true, references: 'videos', onDelete: 'CASCADE' },
name: { type: 'varchar(50)', notNull: true }, // talkinghead | square | fullscreen | fullscreen2
x: { type: 'varchar(20)' }, // e.g. "-30%" or "0%"
y: { type: 'varchar(20)' },
width: { type: 'varchar(20)' }, // optional — height alone can define aspect
height: { type: 'varchar(20)' },
created_at: { type: 'timestamptz', notNull: true, default: pgm.func('NOW()') },
updated_at: { type: 'timestamptz', notNull: true, default: pgm.func('NOW()') },
});
pgm.addConstraint('cutouts', 'cutouts_project_name_unique', 'UNIQUE (project_id, name)');
};
exports.down = (pgm) => { pgm.dropTable('cutouts'); };