Repository navigation
ateapi: squash PostgreSQL migrations and lock them once merged - #2991
Merged
Eitan Yarmush (EItanya) merged 7 commits intoOct 23, 2026
Merged
Eitan Yarmush (EItanya) merged 7 commits into
Eitan Yarmush (EItanya) merged 7 commits into
Conversation
New databases now run one migration instead of three. Databases created by v0.5.0 or earlier cannot be upgraded and must be recreated. The migration verifier now treats migrations in any vX.Y.Z tag after v0.5.x as released and immutable.
The verifier now compares against the merge base with the target branch instead of the latest release tag. Databases built from main also record migration versions, so an edit to a merged migration was skipped there.
A failed check no longer stops the unit tests and verifiers in run-tests.
verify-all.sh passes no arguments, so the check now skips the merge-base comparison when no base ref is given.
| if-no-files-found: error | ||
| - name: verify | ||
| run: hack/verify-all.sh | ||
| verify-migrations: |
Collaborator
There was a problem hiding this comment.
We're having trouble with runner availability. Can we keep this check where it was for now
Collaborator
Author
There was a problem hiding this comment.
That's fine with me. It'll just need an admin override to merge this since it'll be failing a required check. I believe it will also fail that check in the merge queue, so I'm not sure what that'll look like to get this in.
A separate job takes another runner.
Collaborator
|
Note Benjamin Elder (@BenTheElder) we're adding a new job here to separate out the SQL immutability so we can control the blockingness of it. |
Eitan Yarmush (EItanya)
approved these changes
Oct 23, 2026
Eitan Yarmush (EItanya)
enabled auto-merge
October 23, 2026 17:34
Merged
via the queue into
agent-substrate:main
with commit Oct 23, 2026
85e475f
15 of 16 checks passed
Jeremy Alvis (iplay88keys)
deleted the
iplay88keys/compact-pg-migrations
branch
October 23, 2026 18:12
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.
For #1399.
Important
Recreate every existing Substrate PostgreSQL database after this merges, including dev databases built from
main. ateapi can't upgrade a database created before the squash.verify-migrationsfails on this PR because the squash changes migrations already onmain. It isn't a required check yet, so it doesn't block the merge. After this merges, a maintainer should add it to the required checks in themainruleset.New clusters run every migration at startup. Squashing
000001to000003into000001_initial.sqlcuts that to one. I applied the three original files and the squashed file to empty databases, and theirpg_dump --schema-onlyoutput matched.Nothing detects an old database. A v0.6.0 database still starts, because its schema matches and
schema_migrationsalready records versions 1 to 3. Goose would then treat the next000002and000003as applied and skip them. A v0.2.0 or v0.3.0 database lacks the access policy tables and also starts, because the store accepts a ledger that is ahead of the binary.hack/verify/postgresql-migrations.shnow compares against the merge base with the target branch, instead of the latest v1+ tag. Clusters built frommainalso record migration versions, so an edit to a merged but unreleased migration was skipped there too. The check moves out ofrun-testsinto its ownverify-migrationsjob, so a failure no longer stops the unit tests and verifiers. The job runs on pull requests and merge groups, not on pushes tomain.hack/verify-all.shruns the script without a base ref, which checks only the file rules.I can move the migration check to a follow-up PR if that's easier to review. If the squash merges first, neither PR fails
verify-migrations.AI disclosure: Claude Code made the changes and this description.