You are here

private function Schema::createTechnicalPrimaryKeyIndexSql in Drupal driver for SQL Server and SQL Azure 3.0.x

Same name and namespace in other branches
  1. 8 drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::createTechnicalPrimaryKeyIndexSql()

Create technical primary key index SQL.

Create the SQL needed to add a new technical primary key based on a computed column.

Parameters

string $table: Table name.

Return value

string SQL string.

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php, line 1336

Class

Schema

Namespace

Drupal\Driver\Database\sqlsrv

Code

private function createTechnicalPrimaryKeyIndexSql($table) {
  $result = [];
  $result[] = self::TECHNICAL_PK_COLUMN_NAME . " UNIQUEIDENTIFIER DEFAULT NEWID() NOT NULL";
  $result[] = "CONSTRAINT {{$table}}_pkey_technical PRIMARY KEY CLUSTERED (" . self::TECHNICAL_PK_COLUMN_NAME . ")";
  return implode(' ', $result);
}