- Add the
db_sync
folder to your Symphonyextensions
folder. - Go to
Symphony Admin
>System
>Preferences
- Enable the extension by selecting
Database Synchroniser
in the list and chooseEnable
from the with-selected menu, then clickApply
.
As of version 0.7, queries are stored (only by default, see Version 1.1.0
notes below) in a file named db_sync.sql
in your /manifest
folder. This file is visible to anyone, therefore I strongly advise that this extension only be enabled on development environments. Don't deploy it to production, or disable it entirely by looking for db_sync
in Symphony's config file. See additional notes re: Version 1.1.0 for options to change the Query Log location.
While this extension has worked well for my own projects, I can't guarantee its stability for your own. My workflow when using a development/staging/production environment is to install this extension on the development server only. When making a release I pull the production database back to staging where I apply the db_sync SQL file. If all goes well after testing, I back up production and run the same db_sync file there. The file is then removed locally and I can continue developing towards another release.
Please, please, please back up your production database before applying any structural changes.
Please Note: All the new features of v1.1.0 are Opt-In, by default there's no change to how the extension functioned in previous versions. (aside from the bug fixes).
-
Fixes: Compatibility with Order Entries extension (thanks to Jonathan Mifsud)
-
Fixes: Compatibility with Symphony 2.4+ API for adding Author name to Query Log comments
-
New Feature: Customise the Query Log location via
config.php
, now relative to project root (remains by default as/manifest/db_sync.sql
). -
New Feature: Preferences panel button to replay all queries in the current Query Log. When enabled it disables Query Logging, thus it is designed for use on non-development deployments (i.e. when using dual-manifest setup) to allow easy DB synchronisation from a development's uploaded Query Log. After synchronisation the Query log is then archived as e.g.
/manifest/db_sync.sql.replayed.2016-03-05-12-35-01
to prevent duplicate replay (but keeping a record of past synchronisations). Disabled by default, enable it viaconfig.php
by settingenable_replay
toyes
for any relevant non-development deployments (e.g. testing, production, etc). See An Example Setup & Workflow section below for step-by-step guide. -
New Feature: Backup and Restore your Symphony Database with buttons on the Preferences page. Uses
mysqldump
andgzip
behind the scenes to make a full, zipped copy of your current database. Restoring the database is likewise handled behind the scenes bymysql
andgunzip
. The exact location of all four binaries are easily edited inconfig.php
. -
New Feature: Track content changes, either as Commented Queries (non-replayed, simply logged as comments for manual review) or as Full Queries (replayed like any other tracked query). Disabled by default, enable it via
config.php
by settingtrack_content
tocomment
(for commented only) oryes
(for full tracking). -
New Feature: Track Author changes, either as Commented Queries (non-replayed, simply logged as comments for manual review) or as Full Queries (replayed like any other tracked query). Disabled by default, enable it via
config.php
by settingtrack_authors
tocomment
(for commented only) oryes
(for full tracking).
Please Note: This feature even when enabled ignores updates to the Author'slast_seen
column since anUPDATE
is made to that column on each page load in the Admin, thus including it in the Query Log generates an large number of useless entries.
Prerequisite: Dual/Symlinked Manifest folder setup, expects a different config.php
for development and production environments.
-
Install the extension.
-
Customise both
config.php
files to set'db_sync'
with'log_dir' => '/sql/'
(note both slashes). -
In your production
config.php
set'db_sync'
with'enable_replay' => 'yes'
-
Add
RewriteRule ^sql/(.*)$ - [F]
to.htaccess
(or Apache config) to prevent access to/sql
directory in production. -
Track
/sql
directory under version control. -
Develop as usual on the your development version.
-
Uplo 4E74 ad (via version control, or however else, FTP etc) your changes (including
/sql/
dir) to your production deployment. -
In
Symphony > Preferences
backup your current production deployment with theBackup Database
button. -
Replay your development Query Log in production with
Synchronise Database from Logs
button. -
Check everything worked as expected, if something went wrong, restore from backup with the
Restore Database from Last Backup
button.
If something did go wrong during synchronisation you'll need to manually investigate which queries caused the problems, look in the archived Query Log in e.g. /sql/db_sync.sql.replayed.2016-03-05-12-35-01