2

Is there any craft command command (shell) which can be used to perform the database updates necessary after a CMS update? (e.g. Craft3 beta-28 to beta29 or multi version updates)

Background: We are deploying our projects with Jenkins and I would want Jenkins to call such a command after each deployment (or after each CMS update). Going to the /admin/ Panel manually to be told that the database needs to be upgraded is not ideal.

1 Answer 1

7

You can use Yii's migrate console command.

Triggered in Craft 3 via craft migrate --type=app.

7
  • And just to make sure: nothing else is done in this (normally) manual step than applying the Yii migrations? Commented Oct 13, 2017 at 10:16
  • Correct... the updater uses the same logic Commented Oct 13, 2017 at 22:42
  • I just had the change to try it, but it does not work. The website itself currently gives me a 503 "Service unavailable", under /admin/ I get "To complete the update, some changes must be made to your database." Commented Nov 13, 2017 at 9:19
  • ... But the manual "craft migrate" still tells me "No new migrations found. Your system is up-to-date." I also tried setting the migration path via "./craft migrate --migrationPath=@vendor/craftcms/cms/src/migrations --interactive=0". Still "no new migrations found": Any ideas? Commented Nov 13, 2017 at 9:57
  • My bad... by default it queries for site migrations. Add the --type=app to tell it to look at Craft migrations. Commented Nov 13, 2017 at 18:04

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.