[PR #2883] [MERGED] hscontrol/db: add init schema, drop pre-0.25 support #2919

Closed
opened 2025-12-29 04:19:39 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/2883
Author: @kradalby
Created: 11/12/2025
Status: Merged
Merged: 11/13/2025
Merged by: @kradalby

Base: mainHead: kradalby/init-schema


📝 Commits (10+)

  • f3d1643 hscontrol/db: remove pre-0.24.0 test schemas
  • 15ad76f hscontrol/db: remove pre-0.24.0 hardcoded test cases
  • 552264e build: use nix shell golangci-lint in pre-commit hook
  • 1f79557 hscontrol/db: remove pre-0.24.0 test schemas
  • 9d47656 hscontrol/db: remove 0.23-to-0.24 test cases
  • e37fad9 hscontrol/db: add InitSchema for fresh databases
  • 2fa950a hscontrol/db: reformat multi-line indexes to single-line
  • 23c7c2f docs: add breaking change for removed pre-0.24.0 migrations
  • 7bd6e0b changelog: add breaking change for pre-0.24.0 migration removal
  • 18ce0e4 hscontrol/db: remove migrations before v0.25.0

📊 Changes

223 files changed (+125 additions, -5245 deletions)

View changed files

.golangci-lint-hook.sh (+0 -27)
📝 .pre-commit-config.yaml (+1 -1)
📝 CHANGELOG.md (+15 -0)
📝 hscontrol/db/db.go (+106 -509)
📝 hscontrol/db/db_test.go (+0 -655)
📝 hscontrol/db/schema.sql (+3 -10)
hscontrol/db/testdata/postgres/pre-24-postgresdb.pssql.dump (+0 -0)
hscontrol/db/testdata/sqlite/0-22-3-to-0-23-0-routes-are-dropped-2063_dump.sql (+0 -59)
hscontrol/db/testdata/sqlite/0-22-3-to-0-23-0-routes-fail-foreign-key-2076_dump.sql (+0 -52)
hscontrol/db/testdata/sqlite/0-23-0-to-0-24-0-no-more-special-types_dump.sql (+0 -40)
hscontrol/db/testdata/sqlite/0-23-0-to-0-24-0-preauthkey-tags-table_dump.sql (+0 -40)
hscontrol/db/testdata/sqlite/from_nblock_db01__0.14.0__0.24.0.sql (+0 -97)
hscontrol/db/testdata/sqlite/from_nblock_db01__0.14.0__0.24.1.sql (+0 -95)
hscontrol/db/testdata/sqlite/from_nblock_db01__0.14.0__0.24.2.sql (+0 -95)
hscontrol/db/testdata/sqlite/from_nblock_db01__0.14.0__0.25.0.sql (+0 -98)
hscontrol/db/testdata/sqlite/from_nblock_db01__0.14.0__0.25.1.sql (+0 -101)
hscontrol/db/testdata/sqlite/from_nblock_db01__0.14.0__0.26.1.sql (+0 -81)
hscontrol/db/testdata/sqlite/from_nblock_db02__0.22.1__0.24.0.sql (+0 -98)
hscontrol/db/testdata/sqlite/from_nblock_db02__0.22.1__0.24.1.sql (+0 -104)
hscontrol/db/testdata/sqlite/from_nblock_db02__0.22.1__0.24.2.sql (+0 -113)

...and 80 more files

📄 Description

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.


🔄 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/2883 **Author:** [@kradalby](https://github.com/kradalby) **Created:** 11/12/2025 **Status:** ✅ Merged **Merged:** 11/13/2025 **Merged by:** [@kradalby](https://github.com/kradalby) **Base:** `main` ← **Head:** `kradalby/init-schema` --- ### 📝 Commits (10+) - [`f3d1643`](https://github.com/juanfont/headscale/commit/f3d164347058fbe8625b2d84ab7e09cb846d7c3f) hscontrol/db: remove pre-0.24.0 test schemas - [`15ad76f`](https://github.com/juanfont/headscale/commit/15ad76fddc00360e7a33e773ee5bcdb7c2d8a563) hscontrol/db: remove pre-0.24.0 hardcoded test cases - [`552264e`](https://github.com/juanfont/headscale/commit/552264e27073a10c441c319cd763d5cc571d064c) build: use nix shell golangci-lint in pre-commit hook - [`1f79557`](https://github.com/juanfont/headscale/commit/1f79557e585a7e47cb23a400b007f72415435d6e) hscontrol/db: remove pre-0.24.0 test schemas - [`9d47656`](https://github.com/juanfont/headscale/commit/9d47656ac2d758fbc3145df4c62128bf8cf1d329) hscontrol/db: remove 0.23-to-0.24 test cases - [`e37fad9`](https://github.com/juanfont/headscale/commit/e37fad912820f05211fe42ef7b559aa59fc43758) hscontrol/db: add InitSchema for fresh databases - [`2fa950a`](https://github.com/juanfont/headscale/commit/2fa950ab309cb18e597d751072e4fca975a93767) hscontrol/db: reformat multi-line indexes to single-line - [`23c7c2f`](https://github.com/juanfont/headscale/commit/23c7c2f919ec2b9e4b82b2d36f2ae62cd81a2fa7) docs: add breaking change for removed pre-0.24.0 migrations - [`7bd6e0b`](https://github.com/juanfont/headscale/commit/7bd6e0be186da2e3d76ff13d82c39664db40f048) changelog: add breaking change for pre-0.24.0 migration removal - [`18ce0e4`](https://github.com/juanfont/headscale/commit/18ce0e4ee0e21ad138b3ed856013feffeffea5fd) hscontrol/db: remove migrations before v0.25.0 ### 📊 Changes **223 files changed** (+125 additions, -5245 deletions) <details> <summary>View changed files</summary> ➖ `.golangci-lint-hook.sh` (+0 -27) 📝 `.pre-commit-config.yaml` (+1 -1) 📝 `CHANGELOG.md` (+15 -0) 📝 `hscontrol/db/db.go` (+106 -509) 📝 `hscontrol/db/db_test.go` (+0 -655) 📝 `hscontrol/db/schema.sql` (+3 -10) ➖ `hscontrol/db/testdata/postgres/pre-24-postgresdb.pssql.dump` (+0 -0) ➖ `hscontrol/db/testdata/sqlite/0-22-3-to-0-23-0-routes-are-dropped-2063_dump.sql` (+0 -59) ➖ `hscontrol/db/testdata/sqlite/0-22-3-to-0-23-0-routes-fail-foreign-key-2076_dump.sql` (+0 -52) ➖ `hscontrol/db/testdata/sqlite/0-23-0-to-0-24-0-no-more-special-types_dump.sql` (+0 -40) ➖ `hscontrol/db/testdata/sqlite/0-23-0-to-0-24-0-preauthkey-tags-table_dump.sql` (+0 -40) ➖ `hscontrol/db/testdata/sqlite/from_nblock_db01__0.14.0__0.24.0.sql` (+0 -97) ➖ `hscontrol/db/testdata/sqlite/from_nblock_db01__0.14.0__0.24.1.sql` (+0 -95) ➖ `hscontrol/db/testdata/sqlite/from_nblock_db01__0.14.0__0.24.2.sql` (+0 -95) ➖ `hscontrol/db/testdata/sqlite/from_nblock_db01__0.14.0__0.25.0.sql` (+0 -98) ➖ `hscontrol/db/testdata/sqlite/from_nblock_db01__0.14.0__0.25.1.sql` (+0 -101) ➖ `hscontrol/db/testdata/sqlite/from_nblock_db01__0.14.0__0.26.1.sql` (+0 -81) ➖ `hscontrol/db/testdata/sqlite/from_nblock_db02__0.22.1__0.24.0.sql` (+0 -98) ➖ `hscontrol/db/testdata/sqlite/from_nblock_db02__0.22.1__0.24.1.sql` (+0 -104) ➖ `hscontrol/db/testdata/sqlite/from_nblock_db02__0.22.1__0.24.2.sql` (+0 -113) _...and 80 more files_ </details> ### 📄 Description 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. --- <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 04:19:39 +01:00
adam closed this issue 2025-12-29 04:19:39 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#2919