Skip to content

fix: duplicate branch_name column#5561

Merged
mchalapuk merged 9 commits into
mainfrom
fix/git-branch-column
Jun 18, 2026
Merged

fix: duplicate branch_name column#5561
mchalapuk merged 9 commits into
mainfrom
fix/git-branch-column

Conversation

@mchalapuk

@mchalapuk mchalapuk commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Drop the redundant branch_name column and make git_branch the single canonical branch field (main for live, drafts/* for drafts).
  • Add migration 20260618002817_drop-canvas-version-branch-name: backfill git_branch from branch_name, move the per-draft unique index and check constraint onto git_branch, then drop the column.
  • Update model queries/helpers, API serialization, and agent tools to use git_branch.

branch_name and git_branch carried the same value for drafts and were
otherwise redundant, so drop branch_name and make git_branch the single
canonical branch field (non-null; 'main' for live, drafts/* for drafts).

Add a migration that backfills git_branch from branch_name, moves the
per-draft uniqueness index and check constraint onto git_branch, and drops
the column. Rewrite model queries/helpers, API serialization, and agent
tools to use git_branch, and update tests accordingly.

Signed-off-by: Maciej Chałapuk <maciej@chalapuk.pl>
Co-authored-by: Cursor <cursoragent@cursor.com>
@superplanehq-integration

Copy link
Copy Markdown

👋 Commands for maintainers:

  • /sp start - Start an ephemeral machine (takes ~30s)
  • /sp stop - Stop a running machine (auto-executed on pr close)

@mchalapuk mchalapuk changed the title refactor: consolidate canvas version branch_name into git_branch fix: consolidate canvas version branch_name into git_branch Jun 18, 2026
@mchalapuk mchalapuk changed the title fix: consolidate canvas version branch_name into git_branch fix: remove duplicate branch_name column Jun 18, 2026
@mchalapuk mchalapuk changed the title fix: remove duplicate branch_name column fix: duplicate branch_name column Jun 18, 2026
Recreate the drop-canvas-version-branch-name migration with a fresh
timestamp (20260618012333) so it stays the newest migration in the
repository after main's 20260617203101 was merged in, and regenerate
db/structure.sql.

Signed-off-by: Maciej Chałapuk <maciej@chalapuk.pl>
Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread db/migrations/20260618194426_drop-canvas-version-branch-name.up.sql
lucaspin
lucaspin previously approved these changes Jun 18, 2026
… build

Signed-off-by: Maciej Chałapuk <maciej@chalapuk.pl>
@mchalapuk mchalapuk force-pushed the fix/git-branch-column branch from c94fb90 to 9a3b837 Compare June 18, 2026 19:11
The migration's original timestamp (20260618012333) predated the latest
migration merged from main (20260618170412), so golang-migrate would skip
it on production. Recreate it with a fresh timestamp so it remains the
newest migration in the repository.

Signed-off-by: Maciej Chałapuk <maciej@chalapuk.pl>
Co-authored-by: Cursor <cursoragent@cursor.com>
@mchalapuk mchalapuk force-pushed the fix/git-branch-column branch from b5bd88d to 3414db2 Compare June 18, 2026 19:41
mchalapuk and others added 2 commits June 18, 2026 21:44
Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	db/structure.sql
…erging main

Latest main added migration 20260618170412, which is newer than this
branch's previous migration timestamp. Re-timestamp the branch migration
so it remains the newest migration in the repository and is applied after
main's migrations on production.

Signed-off-by: Maciej Chałapuk <maciej@chalapuk.pl>
Co-authored-by: Cursor <cursoragent@cursor.com>
@mchalapuk mchalapuk merged commit ae38a8b into main Jun 18, 2026
6 checks passed
@mchalapuk mchalapuk deleted the fix/git-branch-column branch June 18, 2026 20:03
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