You are here

protected function Schema::createTechnicalPrimaryColumn in Drupal driver for SQL Server and SQL Azure 8

Same name and namespace in other branches
  1. 8.2 drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::createTechnicalPrimaryColumn()
  2. 3.0.x drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::createTechnicalPrimaryColumn()

Add a primary column to the table.

3 calls to Schema::createTechnicalPrimaryColumn()
Schema::addUniqueKey in drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php
Override DatabaseSchema::addUniqueKey().
Schema::createTable in drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php
{@Inheritdoc}
Schema::dropPrimaryKey in drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php
Override DatabaseSchema::dropPrimaryKey().

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php, line 1481
Definition of Drupal\Driver\Database\sqlsrv\Schema

Class

Schema

Namespace

Drupal\Driver\Database\sqlsrv

Code

protected function createTechnicalPrimaryColumn($table) {
  if (!$this
    ->fieldExists($table, $this->TECHNICAL_PK_COLUMN_NAME)) {
    $this->connection
      ->query("ALTER TABLE {{$table}} ADD {$this->TECHNICAL_PK_COLUMN_NAME} UNIQUEIDENTIFIER DEFAULT NEWID() NOT NULL");
  }
}