You are here

protected function DatabaseQueue::ensureTableExists in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Queue/DatabaseQueue.php \Drupal\Core\Queue\DatabaseQueue::ensureTableExists()
  2. 9 core/lib/Drupal/Core/Queue/DatabaseQueue.php \Drupal\Core\Queue\DatabaseQueue::ensureTableExists()

Check if the table exists and create it if not.

File

core/lib/Drupal/Core/Queue/DatabaseQueue.php, line 266

Class

DatabaseQueue
Default queue implementation.

Namespace

Drupal\Core\Queue

Code

protected function ensureTableExists() {
  try {
    $database_schema = $this->connection
      ->schema();
    $schema_definition = $this
      ->schemaDefinition();
    $database_schema
      ->createTable(static::TABLE_NAME, $schema_definition);
  } catch (DatabaseException $e) {
  } catch (\Exception $e) {
    return FALSE;
  }
  return TRUE;
}