function DatabaseStorage::ensureTableExists
Same name in this branch
- 11.x core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php \Drupal\Core\KeyValueStore\DatabaseStorage::ensureTableExists()
Same name in other branches
- 9 core/lib/Drupal/Core/Config/DatabaseStorage.php \Drupal\Core\Config\DatabaseStorage::ensureTableExists()
- 9 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()
- 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()
Check if the config table exists and create it if not.
Return value
bool TRUE if the table was created, FALSE otherwise.
Throws
\Drupal\Core\Config\StorageException If a database error occurs.
1 call to DatabaseStorage::ensureTableExists()
- DatabaseStorage::write in core/
lib/ Drupal/ Core/ Config/ DatabaseStorage.php - Writes configuration data to the storage.
File
-
core/
lib/ Drupal/ Core/ Config/ DatabaseStorage.php, line 173
Class
- DatabaseStorage
- Defines the Database storage.
Namespace
Drupal\Core\ConfigCode
protected function ensureTableExists() {
try {
$this->connection
->schema()
->createTable($this->table, static::schemaDefinition());
} catch (DatabaseException) {
return TRUE;
} catch (\Exception) {
return FALSE;
}
return TRUE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.