function DatabaseStorage::ensureTableExists
Same name in this branch
- 9 core/lib/Drupal/Core/Config/DatabaseStorage.php \Drupal\Core\Config\DatabaseStorage::ensureTableExists()
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Config/DatabaseStorage.php \Drupal\Core\Config\DatabaseStorage::ensureTableExists()
- 11.x core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php \Drupal\Core\KeyValueStore\DatabaseStorage::ensureTableExists()
- 10 core/lib/Drupal/Core/Config/DatabaseStorage.php \Drupal\Core\Config\DatabaseStorage::ensureTableExists()
- 10 core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php \Drupal\Core\KeyValueStore\DatabaseStorage::ensureTableExists()
- 8.9.x core/lib/Drupal/Core/Config/DatabaseStorage.php \Drupal\Core\Config\DatabaseStorage::ensureTableExists()
Check if the table exists and create it if not.
Return value
bool TRUE if the table exists, FALSE if it does not exists.
File
-
core/
lib/ Drupal/ Core/ KeyValueStore/ DatabaseStorage.php, line 255
Class
- DatabaseStorage
- Defines a default key/value store implementation.
Namespace
Drupal\Core\KeyValueStoreCode
protected function ensureTableExists() {
try {
$database_schema = $this->connection
->schema();
$database_schema->createTable($this->table, $this->schemaDefinition());
} catch (DatabaseException $e) {
} catch (\Exception $e) {
return FALSE;
}
return TRUE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.