[PR #2083] [MERGED] Fix FKs on sqllite migrations #2487

Closed
opened 2025-12-29 03:21:30 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/2083
Author: @mpoindexter
Created: 8/28/2024
Status: Merged
Merged: 8/30/2024
Merged by: @kradalby

Base: mainHead: fix-migration-sqlite


📝 Commits (1)

  • 7aaab7f Fix FKs on sqllite migrations

📊 Changes

1 file changed (+69 additions, -10 deletions)

View changed files

📝 hscontrol/db/db.go (+69 -10)

📄 Description

My take on the right way to solve #2074 and #2063 that leaves the DB in a consistent state whether it's new or migrated

  • have read the CONTRIBUTING.md file
  • raised a GitHub issue or discussed it on the projects chat beforehand
  • added unit tests
  • added integration tests
  • updated documentation if needed
  • updated CHANGELOG.md

Summary by CodeRabbit

  • New Features

    • Improved database migration process, ensuring more reliable management of routes during updates.
    • Added functionality to temporarily disable foreign key constraints during migrations, enhancing data integrity.
  • Bug Fixes

    • Addressed potential data loss by removing invalid routes associated with non-existent nodes before migration.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/juanfont/headscale/pull/2083 **Author:** [@mpoindexter](https://github.com/mpoindexter) **Created:** 8/28/2024 **Status:** ✅ Merged **Merged:** 8/30/2024 **Merged by:** [@kradalby](https://github.com/kradalby) **Base:** `main` ← **Head:** `fix-migration-sqlite` --- ### 📝 Commits (1) - [`7aaab7f`](https://github.com/juanfont/headscale/commit/7aaab7f13d0df89f858306d7d50fad3005bcc9b9) Fix FKs on sqllite migrations ### 📊 Changes **1 file changed** (+69 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `hscontrol/db/db.go` (+69 -10) </details> ### 📄 Description My take on the right way to solve #2074 and #2063 that leaves the DB in a consistent state whether it's new or migrated - [x] have read the [CONTRIBUTING.md](./CONTRIBUTING.md) file - [x] raised a GitHub issue or discussed it on the projects chat beforehand - [ ] added unit tests - [ ] added integration tests - [ ] updated documentation if needed - [ ] updated CHANGELOG.md <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Improved database migration process, ensuring more reliable management of routes during updates. - Added functionality to temporarily disable foreign key constraints during migrations, enhancing data integrity. - **Bug Fixes** - Addressed potential data loss by removing invalid routes associated with non-existent nodes before migration. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 03:21:30 +01:00
adam closed this issue 2025-12-29 03:21:30 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#2487