Skip to content

Run craft up on deploy so content migrations see project config - #4249

Open
ThomasDeMarez wants to merge 1 commit into
deployphp:masterfrom
ThomasDeMarez:craft/up-deploy-order
Open

Run craft up on deploy so content migrations see project config#4249
ThomasDeMarez wants to merge 1 commit into
deployphp:masterfrom
ThomasDeMarez:craft/up-deploy-order

Conversation

@ThomasDeMarez

Copy link
Copy Markdown
  • Bug fix

The deploy task runs content migrations before project config is applied. A content migration therefore can't use a section, entry type or field that arrives with project config in the same deploy. It fails on the first deploy, when the schema it needs doesn't exist yet.

Craft's own up command orders the three phases correctly, and does so identically in Craft 4 and 5.

$this->run('migrate/all', ['noContent' => true, ...]);
$this->run('project-config/apply');
$this->run('migrate/up', ['track' => MigrationManager::TRACK_CONTENT]);

This PR adds a craft:up task and uses it in deploy. craft:migrate/all and craft:project-config/apply keep their current behaviour and stay available.

  • New feature?
  • BC breaks?

Content migrations now run after project config. This is a behaviour change, but now in-line with the Craft CMS docs.

  • Tests added?
  • Docs added?

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