diff --git a/migrations/20261114120000_scenes_relations.js b/migrations/20261114120000_scenes_relations.js index 0c85b47c..38ae6ea8 100644 --- a/migrations/20261114120000_scenes_relations.js +++ b/migrations/20261114120000_scenes_relations.js @@ -57,9 +57,22 @@ exports.up = async function(knex) { ADD CONSTRAINT scenes_relations_not_self CHECK (source_scene_id <> target_scene_id) `); + + // other scenes changed by a revision, e.g. the related scene when a relation is added or removed, so it shows in their history too + await knex.schema.alterTable('scenes_revisions', (table) => { + table.specificType('affected_scene_ids', 'integer[]') + .notNullable() + .defaultTo('{}'); + + table.index('affected_scene_ids', null, 'gin'); + }); }; exports.down = async function(knex) { + await knex.schema.alterTable('scenes_revisions', (table) => { + table.dropColumn('affected_scene_ids'); + }); + await knex.schema.dropTable('scenes_relations'); await knex.schema.dropTable('relations_types'); };