Hello! A question that has often bugged me over the years using ExpressionEngine: Is there a way to ensure that template updates are included in a database back up? For example, when I make changes including template updates to a staging site then move the Staging Site DB to the Live Site, it seems that sometimes the template updates are moved with the DB and other times I have to manually copy the template updates over to the Live Site. Can anyone give me some clarity on whether or not, or when templates are included in DB backups? Thank you!
The templates are moved via the database. However, ExpressionEngine will then sync the templates with files.
If the edit date of a template in the database is newer than the modified date of a template file in user/templates
, then the file is overwritten with the data from the database. Likewise, if the file is newer than the template in the database, the template in the database will be overwritten.
If you know that you only want to preserve templates from the staging database, then you can remove all the files on the live site and then import the database.
I’ll also add though that most workflows I hear about involve both migrating the database and deploying the files through some sort of FTP process or Git workflow.
Andy, Thank you for the well thought-out & communicated response. I thought EE treated the templates similar to that, but had a couple experiences where the newer edited templates did not appear to overwrite the older templates. I will keep track of that next time (if) it happens so we have detail to review.
It is great to have your concrete outline of how EE handles the templates - I could not find it in the DOCs. Your suggested workflows using FTP or GIT sound great. I will move in that direction. Thanks again!
Sure thing. If you’re interested in learning more about Git workflows with EE, TJ Draper from Buzzing Pixel is going to be presenting on this topic next week at the Virtual EE Community Meetup. You can register (free) here: https://t.co/vHmQb1L3fs
This sounds great and I would love to attend. Unfortunately I have a conflicting meeting scheduled for that morning. I would love to watch it afterwards if that will be possible -? Either way I will get a ticket and donate. It is great to see the EE community becoming more active!
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.