function drush_sql_create

8.0.x sql.drush.inc drush_sql_create()
6.x sql.drush.inc drush_sql_create()
7.x sql.drush.inc drush_sql_create()
5.x sql.drush.inc drush_sql_create()
master sql.drush.inc drush_sql_create()

Command callback. Create a database.

File

commands/sql/sql.drush.inc, line 237
Drush sql commands

Code

function drush_sql_create() {
  drush_sql_bootstrap_further();
  $sql = drush_sql_get_class();
  $db_spec = $sql->db_spec();
  // Prompt for confirmation.
  if (!drush_get_context('DRUSH_SIMULATE')) {
    // @todo odd - maybe for sql-sync.
    $txt_destination = (isset($db_spec['remote-host']) ? $db_spec['remote-host'] . '/' : '') . $db_spec['database'];
    drush_print(dt("Creating database !target. Any possible existing database will be dropped!", array('!target' => $txt_destination)));

    if (!drush_confirm(dt('Do you really want to continue?'))) {
      return drush_user_abort();
    }
  }

  return $sql->createdb(TRUE);
}