Skip to content

Add unique constraint on stages name and festival_edition_id#28

Open
chiptus wants to merge 1 commit intomainfrom
claude/fix-csv-import-constraint-kDYYI
Open

Add unique constraint on stages name and festival_edition_id#28
chiptus wants to merge 1 commit intomainfrom
claude/fix-csv-import-constraint-kDYYI

Conversation

@chiptus
Copy link
Copy Markdown
Owner

@chiptus chiptus commented May 8, 2026

Summary

This migration adds a unique constraint to the stages table to ensure that stage names are unique within each festival edition.

Key Changes

  • Added a unique constraint stages_name_festival_edition_id_key on the combination of name and festival_edition_id columns in the stages table

Implementation Details

This constraint prevents duplicate stage names from being created for the same festival edition, while still allowing the same stage name to exist across different festival editions. This maintains data integrity and ensures consistent stage identification within each festival's context.

https://claude.ai/code/session_01DpTFYTgNZPgZCCD2YNQsot

@vercel
Copy link
Copy Markdown

vercel Bot commented May 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
upline Ready Ready Preview, Comment May 8, 2026 3:41pm

chiptus pushed a commit that referenced this pull request May 11, 2026
The migration was failing on staging because (a) the artists.slug dedup
suffix wasn't guaranteed unique — using just the first 6 chars of the
id can still collide — and (b) stages had duplicate (edition, name)
pairs in prod that blocked the new unique constraint outright.

Switch both dedups to append the full id, which is guaranteed unique.
Add a stages dedup mirroring the artists one. Wrap both ADD CONSTRAINT
statements in DO blocks that skip if a constraint of the same name (or
the equivalent stages_name_festival_edition_id_key from PR #28) already
exists, so the migration is safe to re-run.
chiptus added a commit that referenced this pull request May 11, 2026
The migration was failing on staging because (a) the artists.slug dedup
suffix wasn't guaranteed unique — using just the first 6 chars of the
id can still collide — and (b) stages had duplicate (edition, name)
pairs in prod that blocked the new unique constraint outright.

Switch both dedups to append the full id, which is guaranteed unique.
Add a stages dedup mirroring the artists one. Wrap both ADD CONSTRAINT
statements in DO blocks that skip if a constraint of the same name (or
the equivalent stages_name_festival_edition_id_key from PR #28) already
exists, so the migration is safe to re-run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants