-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
hscontrol/db: add init schema, drop pre-0.25 support #2883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pre-0.24.0 databases lack migrations table, causing InitSchema to run instead of migrations. Remove these test schemas as they are incompatible with the current migration system.
Remove test cases for 0.22.3 schemas that lack migrations table. These schemas trigger InitSchema instead of migrations, leaving old tables (routes, machines) that fail schema validation.
Pre-commit hook was using system golangci-lint (Go 1.24) which is incompatible with Go 1.25. Use nix develop to ensure correct version.
Remove test schemas for versions 0.10-0.23 to reduce maintenance burden and focus testing on post-migration versions (0.24.0+).
Remove test cases for 0.23.0 to 0.24.0 migrations to reduce maintenance burden and focus testing on current schema versions.
Add InitSchema function to initialize database schema from scratch using GORM AutoMigrate. Handles index creation with proper formatting to match schema.sql exactly, including partial indexes that GORM cannot create automatically.
Add migration to convert multi-line user identity indexes to single-line format for consistency with schema validation. Update schema.sql and InitSchema to match single-line format.
Document that direct upgrades from databases before 0.24.0 are no longer supported. Users must upgrade through an intermediate version. Note that migrations before 0.28.0 will be removed in 0.29.
525de1a to
3d5d5e0
Compare
3d5d5e0 to
fabbe17
Compare
kradalby
added a commit
to kradalby/headscale
that referenced
this pull request
Nov 13, 2025
Remove support for direct upgrades from databases created before version 0.25.0. Users on older versions must upgrade to v0.25.1 first before upgrading to this version. This removes: - All v0.24.0 migration functions (202407191627, 202408181235, 202409271400) - Pre-v0.24.0 PostgreSQL test database dump - Wrongly-migrated v0.25.1 test case and data - tailscale.com/util/set import (no longer used) Updates CHANGELOG.md to reflect the new minimum supported version. Fixes juanfont#2883
fabbe17 to
5c9daf1
Compare
Remove support for direct upgrades from databases created before version 0.25.0. Users on older versions must upgrade to v0.25.1 first before upgrading to this version. This removes: - All v0.24.0 migration functions (202407191627, 202408181235, 202409271400) - Pre-v0.24.0 PostgreSQL test database dump - Wrongly-migrated v0.25.1 test case and data - tailscale.com/util/set import (no longer used) Updates CHANGELOG.md to reflect the new minimum supported version. Fixes juanfont#2883
5c9daf1 to
18ce0e4
Compare
nblock
approved these changes
Nov 13, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR add a new init schema function to quickly create the correct schema for an empty database/new installation.
In addition, it drops all upgrade support for migrating from before 0.25. This should not be any problem as we require all users to upgrade one version at a time.