Added affected scenes to revision history.
This commit is contained in:
@@ -57,9 +57,22 @@ exports.up = async function(knex) {
|
|||||||
ADD CONSTRAINT scenes_relations_not_self
|
ADD CONSTRAINT scenes_relations_not_self
|
||||||
CHECK (source_scene_id <> target_scene_id)
|
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) {
|
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('scenes_relations');
|
||||||
await knex.schema.dropTable('relations_types');
|
await knex.schema.dropTable('relations_types');
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user