Document schema-format skew in dual boot#21
Draft
JuanVqz wants to merge 1 commit into
Draft
Conversation
db/schema.rb pins a schema-format version in its header, and the older boot cannot load a schema dumped by the newer boot -- loading a Schema[8.0] file under Rails 7.2 raises `ArgumentError: Unknown migration version "8.0"`. This breaks the current-version CI job's db:schema:load, which the skill's own CI examples rely on. - references/ci-configuration.md: add a "Schema Format Skew" caveat -- keep the committed schema in the lower (current) format during the dual-boot window, prepare DBs via db:schema:load on both boots, and revert db/schema.rb after any migrate run under the next boot. - workflows/cleanup-workflow.md: add a step to regenerate db/schema.rb in the new format at cutover, flagging column-type churn (e.g. integer -> bigint from a gem's migration helper) as a separate deliberate decision that may not match the production column. Observed on a live Rails 7.2 -> 8.0 upgrade.
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.
What
Documents a dual-boot hazard hit during a live Rails 7.2 -> 8.0 upgrade:
db/schema.rbpins a schema-format version in its header, and the older boot cannot load a schema dumped by the newer boot.Running any schema-dumping task (
db:migrate,db:prepare,db:schema:dump) under the next boot rewrites the header (ActiveRecord::Schema[7.1]->[8.0]) and can change dumper cosmetics (Rails 8.0 writesenable_extension "pg_catalog.plpgsql"instead of"plpgsql"). Once committed, the current-version CI job'sdb:schema:loadbreaks:This matters because the skill's own CI examples run
db:schema:loadon both boots.Changes
references/ci-configuration.md— new "Schema Format Skew" caveat: keep the committeddb/schema.rbin the lower (current) format for the whole dual-boot window, prepare CI/dev DBs viadb:schema:loadon both boots (newer Rails loads the older format fine; the reverse fails), andgit checkout db/schema.rbafter any localdb:migrateunder the next boot.workflows/cleanup-workflow.md— new step to regeneratedb/schema.rbin the new format at cutover, with a warning to treat column-type churn (e.g.integer->bigint) as a separate deliberate decision: it usually comes from a gem's migration helper (e.g.kt-paperclip'st.attachment), not the Rails bump, and may not match the actual production column. Subsequent steps renumbered.CHANGELOG.md— Unreleased entry.Verification
The
ArgumentErrorwas reproduced directly: loading aSchema[8.0]-format file under Rails 7.2.3.1 raisesUnknown migration version "8.0", while Rails 8.0.5 loads aSchema[7.1]file without issue.