Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions db/migrations/0003_nodes_user_slug_namespace.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- Node slugs become unique per user instead of globally unique (same as routes in 0002).
-- Also re-asserts the routes change from 0002: its snapshot never recorded it, and production
-- had drifted back to the global index until 2026-09-22.
-- Create each per-user index before dropping the global one so uniqueness is never unenforced,
-- and use IF [NOT] EXISTS so the migration is safe on databases where part of it already applied.
CREATE UNIQUE INDEX IF NOT EXISTS "nodes_user_id_slug_key" ON "nodes" USING btree ("user_id","slug");--> statement-breakpoint
DROP INDEX IF EXISTS "nodes_slug_key";--> statement-breakpoint
CREATE UNIQUE INDEX IF NOT EXISTS "routes_user_id_slug_key" ON "routes" USING btree ("user_id","slug");--> statement-breakpoint
DROP INDEX IF EXISTS "routes_slug_key";
Loading
Loading