From 550bf00ffcbe37a342c5ad05fcd4938dde77f2d7 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Sat, 21 Nov 2026 03:39:19 +0100 Subject: [PATCH] Added affected scenes to revision history. --- migrations/20261114120000_scenes_relations.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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'); };