October 2.x CMS_DB_TEMPLATES... possible to auto-update db using file version templates?


I have CMS_DB_TEMPLATES=true in my .env. Is there a way to update the database with the latest file version of the page tpls? (the files in the themes/xyz/pages dir)

The issue is when I work on various branches, the page tpls can change and my database will have another branch’s version stored.

This can be done manually by truncating the table, then going into the backend inspector loading and saving, but doing it one by one is not sustainable. I need some automated process that can do this for all page tpls.


Hi @Jinjo

Here is the workflow for the scenario you mention:

  1. Update the theme in git on the filesystem
  2. Run the theme:copy --import-db command to copy the database files to disk
  3. Use git to compare the changes and reconcile the differences
  4. Commit the changes to git
  5. Run the theme:copy --import-db --purge-db command to wipe the database

Step 5 effectively truncates the database as you’ve described. More on this topic can be found here: