Answers.Body: <p>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.</p>
  
  <p>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. </p>
  
  <p>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.</p>
  
  <p>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. </p>
  
  <p>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.</p>
  
  <p>Some tools to help with this:</p>
  
  <ul>
  <li><a href="https://github.com/boboldehampsink/auditlog" rel="nofollow noreferrer">Audit Log</a></li>
  <li><a href="https://github.com/itmundi/schematic" rel="nofollow noreferrer">Schematic</a></li>
  <li><a href="https://github.com/engram-design/FieldManager" rel="nofollow noreferrer">Field Manager</a></li>
  </ul>
  
  <p><a href="https://craftcms.stackexchange.com/q/10/1016">This thread</a> has more details on different environments; here's another that talks about some <a href="https://craftcms.stackexchange.com/questions/1654/exporting-importing-fields">tools</a> I just linked up above.</p>
  
  <p>Would be awesome for P&amp;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, <a href="http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/7202893-database-sync-across-multiple-environments" rel="nofollow noreferrer">vote for it</a>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-27T11:45:46.400Z
Answers.Text: 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!
Answers.UserDisplayName: Merlin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-27T15:29:18.610Z
Answers.Text: 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](http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/7202893-database-sync-across-multiple-environments) and maybe we'll see it someday (like Commerce).
Answers.UserDisplayName: RitterKnight
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-26T21:08:37.463Z
Answers.LastActivityDate: 2016-07-27T15:29:49.500Z
Answers.LastEditDate: 2017-04-13T12:51:00.303Z
Answers.UserDisplayName: RitterKnight
Body: <p>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. </p>
  
  <p>Is this possible already? If not, what would the process be to record the SQL?</p>
  
Tags: <control-panel><mysql>
Title: Tracking SQL queries from CP changes
ThreadText: # Tracking SQL queries from CP changes
  
  (Asked by: username_0 on 2016-07-26)
  
  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?
  
  **Tags:** control-panel, mysql
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-07-26. Score: 3 | Accepted answer
  
  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:
  
  * [Audit Log](https://github.com/boboldehampsink/auditlog)
  * [Schematic](https://github.com/itmundi/schematic)
  * [Field Manager](https://github.com/engram-design/FieldManager)
  
  [This thread](https://craftcms.stackexchange.com/q/10/1016) has more details on different environments; here's another that talks about some [tools](https://craftcms.stackexchange.com/questions/1654/exporting-importing-fields) 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](http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/7202893-database-sync-across-multiple-environments).
  
  > **Comments:**
  > **username_0**: Brilliant, thanks for the answer @username_1 . 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!  
  > **username_1**: 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](http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/7202893-database-sync-across-multiple-environments) and maybe we'll see it someday (like Commerce).  
  
  ---
  
  