I'm using Drush to sync up my dev, staging and live sites using
sql-sync. I want
sql-sync to create a dump file named using a pattern. For example, I want the dump file to be named
site_database_name__date_time. Looking in
example.drushrc.php I saw you can use
@DATE for the
--result-file option in
sql-dump. I tried using the same pattern in my site alias definition but it didn't quite work. The dump file is created properly, using the replacement pattern. But when it tries to restore the database to the target site it throws an error saying there's no such file as "@DATABASE_@DATE.sql". So it's not making the replacement when it does the restore phase of
sql-sync. Is there a way to get this to work? Or am I taking the wrong approach here?
I realize the
sql-sync documentation references a "temp" directory for these dump files, implying they aren't meant to be kept around. My thought is to keep them around for a record of what was used for each sync in case something goes wrong.
Below is an example of the site alias I'm using, which specifies the
%dump path alias used by
$aliases['dev'] = array( 'uri' => 'dev.example.com', 'root' => '/home/websites/dev.example.com', 'path-aliases' => array( '%files' => 'sites/files', '%dump' => '/home/username/tmp/drush/@DATABASE_@DATE', ), 'command-specific' => array ( 'sql-sync' => array ( 'simulate' => '1', 'structure-tables' => array( 'custom' => array('cache', 'cache_filter', 'cache_menu', 'cache_page', 'history', 'sessions', 'watchdog'), ), ), ), );