Stop auto-injecting engine migrations into host migrate paths#36
Stop auto-injecting engine migrations into host migrate paths#36HamptonMakes merged 2 commits intomainfrom
Conversation
Remove the append_migrations initializer so engine migrations don't run automatically with the host's db:migrate. Hosts should use the standard Rails workflow: rails coplan:install:migrations to copy engine migrations into db/migrate/, then rails db:migrate. Amp-Thread-ID: https://ampcode.com/threads/T-019ca0be-66f9-715f-8d94-944467f13298 Co-authored-by: Amp <amp@ampcode.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aa4d67fcab
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| app.config.assets.paths << Engine.root.join("app/javascript") | ||
| end |
There was a problem hiding this comment.
Preserve engine migration path for host db:migrate
Removing the migration-path initializer drops engine/db/migrate from the host migration search path, so environments that run only db:migrate/db:prepare will silently stop applying future CoPlan schema changes unless they remember an extra coplan:install:migrations step every upgrade. In this repo there is no automated install step (only docs mention it), so a later engine migration would leave production/test DBs behind the code and cause runtime failures when new columns/tables are referenced.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Can you add that extra step?
Add a rake task that enhances db:migrate to run co_plan:install:migrations first, so hosts never silently fall behind on CoPlan schema changes. Copy the existing engine migration into the host app's db/migrate/ with its original timestamp. Addresses review feedback on PR #36. Amp-Thread-ID: https://ampcode.com/threads/T-019caf1c-e05e-773a-9c73-047ff1d5c0e8 Co-authored-by: Amp <amp@ampcode.com>
Removes the
coplan.append_migrationsinitializer that automatically added engine migrations to the host's migration paths.Hosts should now use the standard Rails engine workflow:
This gives hosts control over when engine migrations are adopted.