protected 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.
File
- core/lib/Drupal/Core/Config/DatabaseStorage.php, line 162
Class
- DatabaseStorage
- Defines the Database storage.
Namespace
Drupal\Core\Config
Code
protected function ensureTableExists() { try { if (!$this->connection->schema()->tableExists($this->table)) { $this->connection->schema()->createTable($this->table, static::schemaDefinition()); return TRUE; } } // If another process has already created the config table, attempting to // recreate it will throw an exception. In this case just catch the // exception and do nothing. catch (SchemaObjectExistsException $e) { return TRUE; } catch (\Exception $e) { throw new StorageException($e->getMessage(), NULL, $e); } return FALSE; }
Please login to continue.