1

We are developing over multiple environments and production stages, and we would like to be able to track the SQL changes that happen when we make a change to entries etc. on the CP. The changes don't seem to be very easily transferable between productions e.g. Development and Staging through something like an mysql_delta.

Is this possible already? If not, what would the process be to record the SQL?

3

Lots of smart people have tried to solve this problem and it's a tough one to solve, not just in Craft land but WP, and others. And because of Craft's flexible nature, a change in one table usually means many more updates from others.

Arguably the most reliable way I've seen it done is to use a "top-down" approach. Make the content changes in the production data first, then pull them down to staging/dev since production is essentially the "canonical" version.

If you need to make a new field or whatever to keep things current, add it on both sides. Then do your logic part—anything that could cause something to break the front end—on staging.

If you write your own logic for plugins, look into migrations; Craft can handle schema changes pretty well from an old schema to a new one if you write them properly. If you find your developers are doing this a lot, you may need to revisit your content strategy.

Keeping the content in sync is one thing; doing dev work on a rapidly changing schema is tough no matter how you keep things in sync.

Some tools to help with this:

This thread has more details on different environments; here's another that talks about some tools I just linked up above.

Would be awesome for P&T to pull a rabbit out of their hat and have some sort of sync across environments as a first party solution, like they did with Commerce. If you want to see something like that, vote for it.

2
  • 1
    Brilliant, thanks for the answer @RitterKnight . It's as I thought, no easy solution, but the top-down approach makes the most sense as it won't be breaking changes until the logic comes in, which can be done on dev. Will peruse through those tools too, thanks again!
    – Merlin
    Jul 27 '16 at 11:45
  • Yeh, I wish there was more of a clear-cut answer! Forgot to mention in the answer if you want to see something like this in core, vote for it and maybe we'll see it someday (like Commerce). Jul 27 '16 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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