Skip to content

Remove auto-enhance of db:migrate with install:migrations#87

Merged
HamptonMakes merged 1 commit intomainfrom
remove-db-migrate-enhance
Apr 7, 2026
Merged

Remove auto-enhance of db:migrate with install:migrations#87
HamptonMakes merged 1 commit intomainfrom
remove-db-migrate-enhance

Conversation

@HamptonMakes
Copy link
Copy Markdown
Collaborator

Problem

The engine's coplan.rake enhances db:migrate with co_plan:install:migrations as a prerequisite. This causes db:migrate to try copying engine migration files into db/migrate/ before running.

In deployed containers (staging/production) the filesystem is read-only, so this fails with Errno::EROFS, aborting db:migrate entirely. Pending migrations never run → health check returns 500 → deploy never goes healthy.

Fix

Remove the enhance. Host apps should copy engine migrations explicitly when bumping the gem:

bin/rails co_plan:install:migrations
bin/rails db:migrate

A CI spec is being added to coplan-square to catch any forgotten copies.

Context

This was blocking the staging deploy of coplan-square: https://console.sqprod.co/app/coplan-square/deploy/cloud-cd/kube

The enhance causes db:migrate to try copying engine migration files
into the host's db/migrate/ directory before running. In deployed
containers with a read-only filesystem this fails with Errno::EROFS,
preventing migrations from running and causing health check failures.

Host apps should copy engine migrations explicitly when bumping the
gem version:

  bin/rails co_plan:install:migrations
  bin/rails db:migrate

Amp-Thread-ID: https://ampcode.com/threads/T-019d69ae-2fa0-7436-9583-06479ace64c7
Co-authored-by: Amp <amp@ampcode.com>
@HamptonMakes HamptonMakes merged commit 1a96edb into main Apr 7, 2026
5 checks passed
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