| 1 |
<?php |
<?php |
| 2 |
// $Id: sql.drush.inc,v 1.26 2009/10/30 06:13:21 weitzman Exp $ |
// $Id: sql.drush.inc,v 1.27 2009/10/31 02:21:18 weitzman Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file Drush sql commands |
* @file Drush sql commands |
| 20 |
return dt('Prints the whole database to STDOUT or save to a file.'); |
return dt('Prints the whole database to STDOUT or save to a file.'); |
| 21 |
case 'drush:sql query': |
case 'drush:sql query': |
| 22 |
return dt("Usage: drush [options] sql query <query>...\n<query> is a SQL statement, which can alternatively be passed via STDIN. Any additional arguments are passed to the mysql command directly."); |
return dt("Usage: drush [options] sql query <query>...\n<query> is a SQL statement, which can alternatively be passed via STDIN. Any additional arguments are passed to the mysql command directly."); |
|
case 'drush:sql load': |
|
|
return dt("Usage: drush [options] sql load <source_dir> <target_dir>.\n <source_dir> and <target_dir> are names of directories under \'sites\'. These determine from where and to where you want your database copied. Optional: specify \'common\' for --skip if you wish to omit disposable tables like cache*, search*, etc. Your skip lists are specified in your drushrc.php file. Any additional arguments are passed to the mysqldump command directly."); |
|
| 23 |
case 'drush:sql sync': |
case 'drush:sql sync': |
| 24 |
return dt("Usage: drush [options] sql sync <source_alias> <target_alias>.\n <source_alias> and <target_alias> are site aliases, or names of directories under \'sites\'. These determine from where and to where you want your database copied."); |
return dt("Usage: drush [options] sql sync <source_alias> <target_alias>.\n <source_alias> and <target_alias> are site aliases, or names of directories under \'sites\'. These determine from where and to where you want your database copied."); |
| 25 |
} |
} |
| 73 |
'options' => $options, |
'options' => $options, |
| 74 |
'aliases' => array('sqlq'), |
'aliases' => array('sqlq'), |
| 75 |
); |
); |
|
$items['sql load'] = array( |
|
|
'callback' => 'drush_sql_load', |
|
|
'description' => 'Copy source database to target database.', |
|
|
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION, |
|
|
'examples' => array( |
|
|
'drush sql load prod dev' => 'Copy the DB defined in sites/prod to the DB in sites/dev.', |
|
|
), |
|
|
'arguments' => array( |
|
|
'from' => 'Name of subdirectory within /sites. Its settings.php defines where to dump from.', |
|
|
'to' => 'Name of subdirectory within /sites. Its settings.php defines the destination for the dump.', |
|
|
), |
|
|
'options' => array( |
|
|
'--skip-tables-key' => 'A key in the $skip_tables array. @see example.drushrc.php. Optional.', |
|
|
'--structure-tables-key' => 'A key in the $structure_tables array. @see example.drushrc.php. Optional.', |
|
|
'--source_database' => 'The SOURCE DB connection key if using multiple connections in settings.php.', |
|
|
'--destination_database' => 'The DESTINATION DB connection key if using multiple DB connections', |
|
|
), |
|
|
); |
|
| 76 |
$items['sql sync'] = array( |
$items['sql sync'] = array( |
| 77 |
'description' => 'Copy source database to target database using rsync.', |
'description' => 'Copy source database to target database using rsync.', |
| 78 |
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION, |
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION, |
| 101 |
'--db-su' => 'Remote account to use when creating a new database. Optional.', |
'--db-su' => 'Remote account to use when creating a new database. Optional.', |
| 102 |
), |
), |
| 103 |
); |
); |
| 104 |
if (drush_drupal_major_version() >=7) { |
if (drush_drupal_major_version() >= 7) { |
| 105 |
$items['sql load']['options'] += array( |
|
| 106 |
'--source_target' => 'The name of a target within the SOURCE database.', |
$items['sql sync']['options'] += array( |
| 107 |
'--destination_target' => 'The name of a target within the specified DESTINATION database.', |
'--source-target' => 'The name of a target within the SOURCE database.', |
| 108 |
|
'--destination-target' => 'The name of a target within the specified DESTINATION database.', |
| 109 |
); |
); |
| 110 |
} |
} |
| 111 |
$items['sql cli'] = array( |
$items['sql cli'] = array( |