function Schema::createSchemaFromDefinition

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Database/Schema.php \Drupal\Core\Database\Schema::createSchemaFromDefinition()

Creates the tables in a schema definition.

Parameters

\Drupal\Core\Database\SchemaDefinition\Schema $schema: A Schema definition.

Throws

\Drupal\Core\Database\SchemaObjectExistsException If any of the specified tables already exists.

\BadMethodCallException When concrete driver class is missing implementations.

File

core/lib/Drupal/Core/Database/Schema.php, line 644

Class

Schema
Provides a base implementation for Database Schema.

Namespace

Drupal\Core\Database

Code

final public function createSchemaFromDefinition(SchemaDefinition $schema) : void {
  foreach ($schema->tables as $table) {
    $this->createTableFromDefinition($schema->type, $schema->name, $table);
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.