public function Sqlsqlite::createdb

8.0.x Sqlsqlite.php public Sqlsqlite::createdb($quoted = FALSE)
7.x Sqlsqlite.php public Sqlsqlite::createdb($quoted = FALSE)
master Sqlsqlite.php public Sqlsqlite::createdb($quoted = FALSE)

Create a new database.

Parameters

boolean $quoted: Quote the database name. Mysql uses backticks to quote which can cause problems in a Windows shell. Set TRUE if the CREATE is not running on the bash command line.

Overrides SqlBase::createdb

File

lib/Drush/Sql/Sqlsqlite.php, line 30

Namespace

Drush\Sql

Class

Sqlsqlite

Code

public function createdb($quoted = FALSE) {
  $file = $this->db_spec['database'];
  if (file_exists($file)) {
    drush_log("SQLITE: Deleting existing database '$file'", LogLevel::DEBUG);
    drush_delete_dir($file, TRUE);
  }

  // Make sure sqlite can create file
  $path = dirname($file);
  drush_log("SQLITE: creating '$path' for creating '$file'", LogLevel::DEBUG);
  drush_mkdir($path);
  if (!file_exists($path)) {
    drush_log("SQLITE: Cannot create $path", LogLevel::ERROR);
  }
}