function Schema::getSequenceName

Same name in other branches
  1. 11.x core/modules/pgsql/src/Driver/Database/pgsql/Schema.php \Drupal\pgsql\Driver\Database\pgsql\Schema::getSequenceName()

Retrieves a sequence name that is owned by the table and column..

Parameters

string $table: A table name that is not prefixed or quoted.

string $column: The column name.

Return value

string|null The name of the sequence or NULL if it does not exist.

1 call to Schema::getSequenceName()
Schema::changeField in core/modules/pgsql/src/Driver/Database/pgsql/Schema.php
Change a field definition.

File

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

Class

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

Namespace

Drupal\pgsql\Driver\Database\pgsql

Code

protected function getSequenceName(string $table, string $column) : ?string {
    return $this->connection
        ->query("SELECT pg_get_serial_sequence(:table, :column)", [
        ':table' => $this->defaultSchema . '.' . $this->connection
            ->getPrefix() . $table,
        ':column' => $column,
    ])
        ->fetchField();
}

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