Create a new table from a Drupal table definition.
$name: The name of the table to create.
$table: A Schema API table definition array.
Drupal\Core\Database\SchemaObjectExistsException If the specified table already exists.
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);
}
}