Repository navigation
feat(database)!: squash the migrations into a 001 baseline, one migration per release (SPEC-032) - #117
Open
uw-sc wants to merge 5 commits into
Conversation
uw-sc
force-pushed
the
feature/596-database-squash-the-migrations-restart-at-001-one-migration-per-release
branch
from
November 26, 2026 10:25
e6f52bb to
a70be4a
Compare
added 5 commits
November 26, 2026 17:11
…-node deploy The deploy script's migration step called `lightstack migrate`, a subcommand the server never had: the server started in the foreground and the deployment never finished. Its build step took a filter's exit status for the build's, so a failed build passed, and it assumed make on hosts that may not have it. - make build builds bin/lightstack-migrate beside the server. - deploy-single-node.sh installs make when it is missing, checks the build's own status and both binaries, migrates with `lightstack-migrate up`, and reads its install directory from LIGHTSTACK_DIR. Sourcing it no longer runs main. - test/deploy_single_node_test.sh covers the build and migration steps, and CI runs it. - SCALING, UNIFIED_DEPLOYMENT and VXLAN_IMPLEMENTATION call `lightstack-migrate up` instead of the missing subcommand. - test/migration_test.sh is removed: nothing ran it, it looked for the binary outside bin/, and the Go folder tests already make its file checks. Found while working on cobaltcore-dev/cloud-storage#596. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Uwe Schwaeke <uwe.schwaeke@sap.com>
Packages run their tests in parallel against one database, and two kinds of fixture made other packages' tests fail at random: - The glance and cinder paging tests walked every row the shared seeded project could see, so another package's delete could remove the marker mid-walk. They now see only rows of their own, through a run-unique name and a project of the test's own. - Nova fixtures inserted ports into the seeded project on a network but without a name. Neutron's port listing reads the name as a plain string, and one failed scan aborts the whole result, so its listing test got a 500 while such a port existed. Every fixture port is now a whole port, with a name, a network and a MAC, as Lightstack creates them. That includes the ports that could never reach the listing (a project of their own, no network, or the listing test's own package), so no future listing trips over them either. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Uwe Schwaeke <uwe.schwaeke@sap.com>
…tion per release The 83 migrations up to 083 are replaced by one generated baseline per backend, 001, which builds the same schema and seed data as the history; the equivalence tests prove it on both backends. From now on a release adds at most one migration, NNN_v<release>. Between releases a schema change is a fragment in migrations/next/, named by its UTC creation time, ticket and purpose instead of a number, so parallel changes never compete for one. The per-backend view assembles the fragments into the open release migration. - Every migration records its checksum in applied_migrations, whose presence marks a post-squash database. A database migrated before the squash is refused at start and by lightstack-migrate, untouched, with the way out: recreate it. A database that applied an earlier state of its version is refused as stale. On SQLite, five project_id columns are now NOT NULL in the schema, as on PostgreSQL. - lightstack-migrate status names what a version is (baseline, release, open release migration) and reports PRE-SQUASH, STALE and NO DATABASE. lightstack-migrate freeze and make migrations-freeze freeze a release, all or nothing; make migration-fragment creates an empty fragment pair. - CI fails a change to a numbered migration once it is on main, and a v* tag that still carries fragments. - v0.7.0 is a fresh install: docs/UPGRADING.md keeps one section per release, and there is no re-stamp. scripts/upgrade-lightstack.sh is removed: it served bare-metal checkouts only, and its migration step could never finish. - The old migrations survive as the generators' input in internal/database/testdata/pre-squash/. Comments and docs no longer cite their numbers, and the tests tied to a single old migration are retired. BREAKING CHANGE: a database migrated by an earlier Lightstack is refused. Recreate it; see docs/UPGRADING.md, "The migration squash". Spec: docs/specs/032-migration-squash-per-release/ Refs: cobaltcore-dev/cloud-storage#596 Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Uwe Schwaeke <uwe.schwaeke@sap.com>
The paragraph said a node sets the volume and snapshot reservations it left behind to error at its startup. Since the periodic pass, a reservation whose owner has stopped heartbeating is set to error without waiting for a restart, as the code and the constitution say. The upgrade note that described this is gone, so this paragraph is now where an operator reads it. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Uwe Schwaeke <uwe.schwaeke@sap.com>
scripts/migrate-legacy-state.sh and the chart's realMode.legacyStatePath initContainer moved a node's state from the pre-rename root into the new one, in place. v0.7.0 is a fresh install: the old images, volumes and instance disks belong to the database it replaces, so moving them would only plant orphans under the new root. Removed: both scripts (the mover and its test, which nothing ran), and the chart's value, schema entry, README row, initContainer, volume and unit tests. The tasks of SPEC-032 record this and the fixes of the branch review. BREAKING CHANGE: a values file that still sets realMode.legacyStatePath fails the chart's schema; delete the key. Refs: cobaltcore-dev/cloud-storage#596 Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Uwe Schwaeke <uwe.schwaeke@sap.com>
uw-sc
force-pushed
the
feature/596-database-squash-the-migrations-restart-at-001-one-migration-per-release
branch
from
November 26, 2026 16:18
a70be4a to
17b2225
Compare
uw-sc
marked this pull request as ready for review
November 26, 2026 16:18
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
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.
Summary
Squashes the 83 migrations into one generated baseline per backend,
001, which builds the sameschema and seed data. From now on a schema change is an unnumbered fragment in
migrations/next/,frozen into one migration per release (
NNN_v<release>), so parallel branches no longer collide onmigration numbers.
Refs cobaltcore-dev/cloud-storage#596 · Spec:
docs/specs/032-migration-squash-per-release/What's in it
001_baseline.{postgres,sqlite}, generated from the old history, which moves tointernal/database/testdata/pre-squash/. On SQLite, fiveproject_idcolumns are nowNOT NULLinstead of trigger-guarded.
make migration-fragment,make migrations-freeze;applied_migrationsrecords each migration'schecksum. Pre-squash and stale databases are refused with the way out: recreate.
main; av*tag with fragments fails.scripts/upgrade-lightstack.sh,scripts/migrate-legacy-state.shand the chart valuerealMode.legacyStatePath.deploy-single-node.shmigrates withlightstack-migrate up, and flaky test fixtures fixed.Breaking
v0.7.0 is a fresh install: a database from an earlier Lightstack is refused. Recreate it as
docs/UPGRADING.md, "The migration squash", describes. A values file settingrealMode.legacyStatePathfails the chart schema.Testing
-race) and contract suite (325/0/12) pass on PostgreSQL and SQLite.check and a
pg_dump/ SQLite-catalog comparison against the base branch.🤖 Generated with Claude Code