Skip to content

Stop auto-injecting engine migrations into host migrate paths#36

Merged
HamptonMakes merged 2 commits intomainfrom
remove-auto-migrate-initializer
Mar 2, 2026
Merged

Stop auto-injecting engine migrations into host migrate paths#36
HamptonMakes merged 2 commits intomainfrom
remove-auto-migrate-initializer

Conversation

@HamptonMakes
Copy link
Collaborator

Removes the coplan.append_migrations initializer that automatically added engine migrations to the host's migration paths.

Hosts should now use the standard Rails engine workflow:

rails coplan:install:migrations
rails db:migrate

This gives hosts control over when engine migrations are adopted.

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>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines 18 to 19
app.config.assets.paths << Engine.root.join("app/javascript")
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@HamptonMakes HamptonMakes merged commit 3220948 into main Mar 2, 2026
3 checks passed
@HamptonMakes HamptonMakes deleted the remove-auto-migrate-initializer branch March 2, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant