function Schema::extensionExists

Same name in other branches
  1. 9 core/modules/pgsql/src/Driver/Database/pgsql/Schema.php \Drupal\pgsql\Driver\Database\pgsql\Schema::extensionExists()
  2. 10 core/modules/pgsql/src/Driver/Database/pgsql/Schema.php \Drupal\pgsql\Driver\Database\pgsql\Schema::extensionExists()

Determines whether the PostgreSQL extension is created.

@internal

Parameters

string $name: The name of the extension.

Return value

bool Return TRUE when the extension is created, FALSE otherwise.

File

core/modules/pgsql/src/Driver/Database/pgsql/Schema.php, line 1091

Class

Schema
PostgreSQL implementation of \Drupal\Core\Database\Schema.

Namespace

Drupal\pgsql\Driver\Database\pgsql

Code

public function extensionExists($name) : bool {
    return (bool) $this->connection
        ->query('SELECT installed_version FROM pg_available_extensions WHERE name = :name', [
        ':name' => $name,
    ])
        ->fetchField();
}

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