From 7a226c165d80ec6c55310d33718d3fcb461e2674 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Wed, 20 May 2026 04:47:26 +0200 Subject: [PATCH] Actors table allows for global actors with the same name/slug with unique entry IDs. --- migrations/20260520044355_actors_unique.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 migrations/20260520044355_actors_unique.js diff --git a/migrations/20260520044355_actors_unique.js b/migrations/20260520044355_actors_unique.js new file mode 100644 index 00000000..2254edd3 --- /dev/null +++ b/migrations/20260520044355_actors_unique.js @@ -0,0 +1,13 @@ +exports.up = async function(knex) { + await knex.raw(` + DROP INDEX unique_actor_slugs; + CREATE UNIQUE INDEX unique_actor_slugs ON actors (slug, entry_id) WHERE entity_id IS NULL; + `); +}; + +exports.down = async function(knex) { + await knex.raw(` + DROP INDEX unique_actor_slugs; + CREATE UNIQUE INDEX unique_actor_slugs ON actors (slug) WHERE entity_id IS NULL; + `); +};