I am new to EE and have been tasked to look at the EE schema to figure out a way to export just the changed data from staging to Production. Basically, we don’t want to export and import the entire database. We just want to move the changed data periodically. I tried looking for some documentation on the EE schema and thought that would help me to design some MySQL scripts to do this, but to no avail. Can anybody point me in the right direction?
Thanks in advance
Was hoping someone more learned would respond to you, but oh well!
Have you got an existing EE site to develop with? There is no schema documentation that I know about, but it’s mostly pretty straightforward to pick up, especially if you only want to import channel data and templates (and possibly comments etc, although that would be more complicated, since the channel entry_id is auto-increment, and you would need to update the new entry_id in your imported comments).
If you are never going to edit data on your production site, and always edit on staging first, then that would be even easier, just remove the auto-increment and do entire table dumps. The channel entries are stored across two tables (one for custom field data). Likewise if you want to publish changes to your templates, they are all stored in one table.
Thanks for responding. Yes, we do have an existing EE site. It has been developed and is in Production now. I did suggest that the easiest thing for them would be to do an entire dump, but they have certain scenarios where they would like some approved sections to be published to the Production server. We have a custom flag that does indicate what is open and what is closed. But my concern is that I do not understand the schema well enough for me to know which tables get modified when somebody modifies content.
You were mentioning about the channel entries being stored across two tables. Are you talking about exp_channel_titles and exp_channel_data tables?
Thanks again
Yip, those two store your channel entries. So you could happily JOIN them, strip the entry_id, then insert them into your production database. As long as you have the same custom fields on your staging and production environments. It will be slightly more complicated than your average SQL insert statement, but not impossible.
Are you only wanting to move channel entries from staging to production? Or are you talking about your design templates too? If you simply want to have a draft/approved/published workflow for your entries then I was thinking about creating an add-on for that.
I haven’t looked much in to how the templates are stored in the database. The only thing that might throw you is the versioning, but it may be simply a matter of dumping the exp_templates table and importing it. I would try that on a local server first though!
Regarding an entries workflow, you’re probably best to stick with the SQL import/export for now, unless you feel like a heap of php development, or someone beats us to the workflow add-in. EE already supports version control for entries, but as far as I know there is no way to save draft versions while leaving the published version intact. The add-on could also potentially allow for draft/published versions of templates, which would be useful for production websites.
Of course, if you wanted to commission us to build the workflow add-on, it would certainly move it up the priority list! 😊
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.