1

How can sync the schema (fields + categories + tags + sections) from development to staging and live? Or should I do it manually? Is there any support to make migration script instead of do it from the webpage

3 Answers 3

4

With the release of Craft 3.1 you can now keep fields (and other things) in sync between multiple environments.

Read more here: https://docs.craftcms.com/v3/project-config.html

3

See the answer above: project config.

You should check out Andrew Welch's post about it:

https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms

https://github.com/nystudio107/craft-scripts

ps.: Sorry, Andrew!

1
  • I need to sync the schema. Best pratice is always go from dev to staging to live during golive. So I need the script which sync merge the settings. But thx for the help! Commented Feb 18, 2018 at 3:47
1

If you're looking to sync only configuration you shouldn't use the database sync in the article suggested by Otto - that will also bring over content and users and such - unless you intend to create your fields on production and then pull those into dev (which seems like a strange workflow).

There are two ways to do actual schema syncing in Craft 3 that I'm aware of:

  • Writing your own content migrations (using the Craft PHP API to create fields/sections etc by hand)
  • Use the architect plugin (currently under development) to sync your config by exporting it to json, then importing it on your other environments. https://github.com/Pennebaker/craft-architect

For Craft 2 there's also Schematic (https://github.com/nerds-and-company/schematic) but there's no word on a release for Craft 3 yet.

1
  • I was trying to find a api doc for that but did but did not get it. We will use that. Could you please link it. I am new in craft yii (coming from laravel) so need to catch up quickly Commented Feb 18, 2018 at 3:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.