Skip to content

Fix backup hosts migration - #2468

Merged
Boy132 merged 1 commit into
mainfrom
boy132/fix-backup-hosts-migration
Jul 21, 2026
Merged

Fix backup hosts migration#2468
Boy132 merged 1 commit into
mainfrom
boy132/fix-backup-hosts-migration

Conversation

@Boy132

@Boy132 Boy132 commented Jul 20, 2026

Copy link
Copy Markdown
Member

Closes #2447

The migration failed with foreign key constraint errors because the foreign key was added before the table data was populated. Changing the order of operations and temporarily making the column nullable fixes these issues.

@Boy132 Boy132 self-assigned this Jul 20, 2026
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 25085302-b92c-4003-9bd5-749008f89ab1

📥 Commits

Reviewing files that changed from the base of the PR and between 880f20b and 5d5c8a1.

📒 Files selected for processing (1)
  • database/migrations/2026_01_16_081858_create_backup_hosts_table.php

📝 Walkthrough

Walkthrough

The backup host migration now adds backup_host_id as nullable for existing-row backfilling, enforces it after population, adds the foreign key, removes disk, and drops dependent objects before backup_hosts during rollback.

Changes

Backup host migration

Layer / File(s) Summary
Backup host relationship migration
database/migrations/2026_01_16_081858_create_backup_hosts_table.php
The migration stages backup_host_id as nullable, later makes it non-nullable and adds its foreign key before dropping disk; rollback now removes backup_host_node before backup_hosts.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the migration fix.
Description check ✅ Passed The description directly explains the foreign key migration failure and the fix applied.
Linked Issues check ✅ Passed The migration now backfills data before adding the foreign key and avoids the constraint failure described in #2447.
Out of Scope Changes check ✅ Passed The changes stay focused on the backup hosts migration and its rollback order, with no clear unrelated additions.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Boy132
Boy132 merged commit 7d9400f into main Jul 21, 2026
16 checks passed
@Boy132
Boy132 deleted the boy132/fix-backup-hosts-migration branch July 21, 2026 07:17
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 21, 2026
ItzExotical added a commit to officialhypefox/velrix-control that referenced this pull request Jul 25, 2026
Brings in 6 upstream commits (installer redirect pelican#2438, backup-hosts migration
fix pelican#2468, relation-manager cleanup pelican#2456, translations, test fixes).

One conflict: the create_backup_hosts_table migration. Our fork carried an
equivalent local fix for the same migration bug (adding backup_host_id nullable
then tightening to NOT NULL after backfill); upstream pelican#2468 fixes it by
deferring the FK + dropColumn('disk') to after the backfill. Both yield the
identical final schema, so resolved in favor of upstream to keep the fork
aligned for clean future merges. The Velrix SSO endpoint is unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2026_01_16_081858_create_backup_hosts_table migration fails

2 participants