<p>Late to the table but... </p>

<p>I've been working on a Craft 2 site for a client that need to be able to combine a large amount of modules on each page (A matrix with 25+ blocks and counting). I found myself adding lots of complicated fields and then manually copying the information to staging and live... Tedious and dumb.</p>

<p>After trying several json-field import/export plugins with undesirable results (and one complete crash) I finally found <strong><a href="https://github.com/Firstborn/Craft-CMS-Migration-Manager" rel="nofollow noreferrer">Craft-CMS-Migration-Manager</a></strong>. It simply uses Crafts (Or Yii's) <a href="https://docs.craftcms.com/v2/plugins/migrations.html" rel="nofollow noreferrer">builtin migration scripts</a> to keep your database up to sync. Works like a charm!</p>

<p>The plugins seems to be <a href="https://github.com/Firstborn/Craft-Migration-Manager" rel="nofollow noreferrer">available for Craft 3</a> as well.</p>

<p>The plugin will generate migration files for you that you can review and commit to your repository. You then deploy to staging and/or live sites where you will be able to run them through the plugin or through the command line if you prefer.</p>

<p>If the migrations fails it will automatically rollback to the previous db.</p>

<p>Seems like the most solid way to keep your databases in sync, and you will have all relevant changes to the db committed to your repository.</p>

<p>Happy migrating!</p>

CC BY-SA 4.0
2018-06-26T19:43:40.247Z
2018-06-26T19:43:40.247Z
Kristoffer Zaar
<p>I hear ya. </p>

<p>The tricky thing is when it's templates distributed to people/setups for use as a platform for whatever they want to build, without them having the know-how in terms of programming or databases other than HTML/CSS.</p>

<p>Pushing updates in a simple way would be fantastic... </p>

<p>The main thing missing is essentially; </p>

<p><code>find field, global, structure, user or group or whatever is selected when exporting</code> > </p>

<p><code>if not exist, create</code> > </p>

<p><code>if exist compare field settings</code> > </p>

<p><code>if name, description or type different, change one or all of the above</code> </p>

<p>An easy and straightforward way of doing that...</p>

CC BY-SA 3.0
2017-05-18T21:33:04.287Z
2017-05-18T21:33:04.287Z
Anders
<h2>The Migrations</h2>

<p>This is an ongoing issue. My best call is currently, to do the changes on production and to sync the DB locally.</p>

<p>I see a lot of folks, using plugins to "lock" the editing for the time, changes are being made. Sync to local, edit, resync to production.</p>

<p>As this is not satisfying, there was discussion with the Craft Team and the result is, for now, migrations coming to Craft 3.</p>

<p><a href="https://craftcms.com/news/craft-3-content-migrations" rel="nofollow noreferrer">https://craftcms.com/news/craft-3-content-migrations</a></p>

<p>This way you basically can create your own migrations from the command line. This should solve your problem, BUT: you should not use Craft 3 in production, yet.</p>

<h2>Theming (off topic)</h2>

<p>Something like theming is not possible and I think also won't be really in the future.</p>

<p>I solve this by having a Craft CMS dummy on github, which has most setup stuff I usually need (gruntfile, basic partials for matrices I use often). This dummy evolves over time and only includes some dummy files and folders like db.sample.php, general.sample.php and for the app a app.sample folder.</p>

<p>For basic content stuff I also use plugins like architect or the import/export plugin, to set up basic SEO fields and globals I usually use.</p>

<p>But most are missing a way to export groups etc. perfectly, but they do their job.</p>

<p>Hope that helps.</p>

CC BY-SA 3.0
2017-05-17T11:14:53.767Z
2017-05-17T11:14:53.767Z
Max Strebel
<p>Is there any "simple" way of migrating fields and layouts from one setup to another?</p>

<p>Example;
Two identical installations/setups have diverged, where some information on certain fields have changed (like descriptive texts and so forth), perhaps there's a SuperTable or Craft Neo field with added blocks, or even a matrix field where there's been blocks added on the one setup, that need to update exactly on the other setup. Perhaps there's been some additions to a structure's field layout. Perhaps something has been removed.</p>

<p>I realize this could possibly be done with some sort of plugin/migration.</p>

<p>The purpose of my question is basically to figure out a) if there's a simple and straight-forward way of doing so programmatically/automated, or b) if there are any plans on, or capability of setting up fields similarly to ACF for WordPress in the theme's function.php—where it can be done programmatically.</p>

<p>A real world usage would be; 
You build a set of templates (a theme, essentially), and when you update the templates (theme) and you want to apply those updates to a separate install/setup, what is the most efficient and "simple" way of doing so in Craft?</p>

<p>I've looked into the architect plugin, which is great for clean installs, but alas my limited php, or rather sql, knowledge makes it hard to expand into querying for field names rather than ID's. Of course there's the caveat that if you change a field's name, you probably need the ID, but if we forget that rabbit hole for a bit, is anyone sitting on any smart and simple tips for this type of approach?</p>

<p>Anyone had any success with FeedMe or the CraftImport plugins?</p>

<templating><database><field><craft-features><migration>
How would one go about migrating fields?
# How would one go about migrating fields?

(Asked by: username_0 on 2017-05-17)

Is there any "simple" way of migrating fields and layouts from one setup to another?

Example;
Two identical installations/setups have diverged, where some information on certain fields have changed (like descriptive texts and so forth), perhaps there's a SuperTable or Craft Neo field with added blocks, or even a matrix field where there's been blocks added on the one setup, that need to update exactly on the other setup. Perhaps there's been some additions to a structure's field layout. Perhaps something has been removed.

I realize this could possibly be done with some sort of plugin/migration.

The purpose of my question is basically to figure out a) if there's a simple and straight-forward way of doing so programmatically/automated, or b) if there are any plans on, or capability of setting up fields similarly to ACF for WordPress in the theme's function.php—where it can be done programmatically.

A real world usage would be;
You build a set of templates (a theme, essentially), and when you update the templates (theme) and you want to apply those updates to a separate install/setup, what is the most efficient and "simple" way of doing so in Craft?

I've looked into the architect plugin, which is great for clean installs, but alas my limited php, or rather sql, knowledge makes it hard to expand into querying for field names rather than ID's. Of course there's the caveat that if you change a field's name, you probably need the ID, but if we forget that rabbit hole for a bit, is anyone sitting on any smart and simple tips for this type of approach?

Anyone had any success with FeedMe or the CraftImport plugins?

**Tags:** templating, database, field, craft-features, migration


---

## 3 answers

### Answer by username_1 on 2018-06-26. Score: 1

Late to the table but...

I've been working on a Craft 2 site for a client that need to be able to combine a large amount of modules on each page (A matrix with 25+ blocks and counting). I found myself adding lots of complicated fields and then manually copying the information to staging and live... Tedious and dumb.

After trying several json-field import/export plugins with undesirable results (and one complete crash) I finally found **[Craft-CMS-Migration-Manager](https://github.com/Firstborn/Craft-CMS-Migration-Manager)**. It simply uses Crafts (Or Yii's) [builtin migration scripts](https://docs.craftcms.com/v2/plugins/migrations.html) to keep your database up to sync. Works like a charm!

The plugins seems to be [available for Craft 3](https://github.com/Firstborn/Craft-Migration-Manager) as well.

The plugin will generate migration files for you that you can review and commit to your repository. You then deploy to staging and/or live sites where you will be able to run them through the plugin or through the command line if you prefer.

If the migrations fails it will automatically rollback to the previous db.

Seems like the most solid way to keep your databases in sync, and you will have all relevant changes to the db committed to your repository.

Happy migrating!


---

### Answer by username_0 on 2017-05-18. Score: 1

I hear ya.

The tricky thing is when it's templates distributed to people/setups for use as a platform for whatever they want to build, without them having the know-how in terms of programming or databases other than HTML/CSS.

Pushing updates in a simple way would be fantastic...

The main thing missing is essentially;

`find field, global, structure, user or group or whatever is selected when exporting` >

`if not exist, create` >

`if exist compare field settings` >

`if name, description or type different, change one or all of the above`

An easy and straightforward way of doing that...


---

### Answer by username_2 on 2017-05-17. Score: 1

## The Migrations

This is an ongoing issue. My best call is currently, to do the changes on production and to sync the DB locally.

I see a lot of folks, using plugins to "lock" the editing for the time, changes are being made. Sync to local, edit, resync to production.

As this is not satisfying, there was discussion with the Craft Team and the result is, for now, migrations coming to Craft 3.

<https://craftcms.com/news/craft-3-content-migrations>

This way you basically can create your own migrations from the command line. This should solve your problem, BUT: you should not use Craft 3 in production, yet.

## Theming (off topic)

Something like theming is not possible and I think also won't be really in the future.

I solve this by having a Craft CMS dummy on github, which has most setup stuff I usually need (gruntfile, basic partials for matrices I use often). This dummy evolves over time and only includes some dummy files and folders like db.sample.php, general.sample.php and for the app a app.sample folder.

For basic content stuff I also use plugins like architect or the import/export plugin, to set up basic SEO fields and globals I usually use.

But most are missing a way to export groups etc. perfectly, but they do their job.

Hope that helps.


---

