docs: show the migration version the provider generator actually emits
Summary
Fork pre-flight for we-promise/sure#3622, which closes we-promise/sure#3621.
docs/api/rails_provider_generator.md, under the heading "What Gets Generated (Detailed)", shows the migration the provider generators produce as ActiveRecord::Migration[7.2]. Both generators derive that version from Rails at generation time, so on upstream main today they emit [8.1]. The guide documents output the tool does not produce.
Why this branch and not up/generator-guide-migration-version
This is a separate branch from the upstream PR's, carrying the same commits, so that the diff reads as the change rather than as the gap between two bases: 1 file, +6/−2, over two commits. The mirror's copy of the file is byte-identical to upstream's, so the cherry-pick is a faithful representation of what upstream will apply.
1e61f823Show the migration version the provider generator actually emits (+5/−2)1ae890d1Separate what the generator emits from what a migration keeps (+5/−4)
The second commit is Codacy thread 4039540575 taken: the first version said the version "will read differently after an upgrade", which reads as your migration's version changing later. It does not — the generator writes the version in use when it runs, and what it writes is then fixed. A guide that can be read as "your migration version changes later" teaches something false.
The upstream twin now carries both commits. The daily sweep found up/generator-guide-migration-version still at the single pre-Codacy commit, so this pre-flight had stopped representing what upstream would receive. 6a19926d8 cherry-picks the reword onto it; the two heads' copies of the file are now byte-identical, and we-promise/sure#3622 has it.
Corrected after the formal review. This paragraph previously said mirror/upstream-main was "3 behind and 9 ahead" of upstream main, which was true when the PR opened at 08:44Z and stopped being true at about 09:29Z, when the mirror workflow force-reset it to upstream 42836ccac. The branch was still rooted at the old mirror head, so the base move turned this into 29 files, +953/−86 — carrying the whole of #146, which merging would have re-landed on the mirror. The branch has been rebuilt from the current mirror with only the doc commit. The cited db/migrate/20260911165424_create_fio_items_and_accounts.rb is present on the current mirror, so that evidence is unaffected.
Evidence
The version is computed, not hardcoded — identically in both generators:
# lib/generators/provider/family/family_generator.rb:870
# lib/generators/provider/global/global_generator.rb:181
def migration_version
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
end
# lib/generators/provider/family/templates/migration.rb.tt:3
class Create<%= class_name %>ItemsAndAccounts < ActiveRecord::Migration<%= migration_version %>
Verified in a console on this tree:
Rails::VERSION::STRING = 8.1.3.1
generator would emit = [8.1]
ActiveRecord::Migration.current_version = 8.1
And in the tree itself: db/migrate/20260911165424_create_fio_items_and_accounts.rb is exactly the Create<X>ItemsAndAccounts shape this template produces, and declares ActiveRecord::Migration[8.1]. The generator is behaving correctly; only the guide is out of step.
A caution on which tree that evidence belongs to. That migration is present on upstream main and on mirror/upstream-main, but not on the fork's own main — where only 2 of 424 migrations are [8.1]. I cited it against the wrong tree once already, on #175, and the Gatekeeper pass caught it. This PR's base carries the file, so the citation holds here; it would not hold on a PR based on the fork's main.
Relationship to #175
#175 is the fork-local half of the same problem: it fixes .cursor/rules/general-rules.mdc, which pins [7.2]. That file is fork-only — upstream's copy is just @AGENTS.md, and upstream AGENTS.md:13 already states the rule correctly — so it is not upstream-bound and is deliberately not in this PR.
#175 also touches the fork's copy of this same doc. The two will meet when #3622 flows back through the mirror; the fork's copy is separately behind upstream by an unrelated ProviderLogo paragraph, so that reconciliation is mirror maintenance rather than something to pre-empt here.
Validation
Docs only — no code, no schema, no behaviour, nothing to test. The claims were verified rather than assumed: generator methods and template read at this head, emitted version confirmed in a console, resulting version checked against a real generated migration in this tree.
Note on we-promise/sure#3620
@janbuchar's #3620 edits the same file upstream, in the item-model section around lines 244–271. This touches line 173. git merge-tree confirms the two do not conflict. Noted so whoever merges second is not surprised to find the file already touched.
- Updated the provider-generator guide example from
ActiveRecord::Migration[7.2]to[8.1]. - Clarified that the generator uses the current Rails version and that generated migrations keep the version set at generation time.
| Author | Lines added | Lines removed |
|---|---|---|
| jaysbeekay | 6 | 2 |