function Update10101::updateSequenceOwnership

Same name and namespace in other branches
  1. 10 core/modules/pgsql/src/Update10101.php \Drupal\pgsql\Update10101::updateSequenceOwnership()

Alters the ownership of a sequence.

This is used for updating orphaned sequences.

Parameters

string $sequence_name: The appropriate sequence name for a given table and serial field.

string $table: The unquoted or prefixed table name.

string $column: The column name for the sequence.

See also

https://www.drupal.org/i/3028706

1 call to Update10101::updateSequenceOwnership()
Update10101::update in core/modules/pgsql/src/Update10101.php
Update *all* existing sequences to include the owner tables.

File

core/modules/pgsql/src/Update10101.php, line 192

Class

Update10101
An update class for sequence ownership.

Namespace

Drupal\pgsql

Code

private function updateSequenceOwnership(string $sequence_name, string $table, string $column) : void {
    $this->connection
        ->query('ALTER SEQUENCE IF EXISTS ' . $sequence_name . ' OWNED BY {' . $table . '}.[' . $column . ']');
}

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