public function Schema::createTable

Create a new table from a Drupal table definition.

Parameters

$name: The name of the table to create.

$table: A Schema API table definition array.

Throws

Drupal\Core\Database\SchemaObjectExistsException If the specified table already exists.

1 call to Schema::createTable()
Schema::alterTable in drupal/core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php
Create a table with a new schema containing the old content.

File

drupal/core/lib/Drupal/Core/Database/Schema.php, line 660
Definition of Drupal\Core\Database\Schema

Class

Schema

Namespace

Drupal\Core\Database

Code

public function createTable($name, $table) {
  if ($this
    ->tableExists($name)) {
    throw new SchemaObjectExistsException(t('Table @name already exists.', array(
      '@name' => $name,
    )));
  }
  $statements = $this
    ->createTableSql($name, $table);
  foreach ($statements as $statement) {
    $this->connection
      ->query($statement);
  }
}