You are here

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

Same name and namespace in other branches
  1. 4.2.x src/Driver/Database/sqlsrv/Schema.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Schema::createTechnicalPrimaryKeyIndexSql()
  2. 3.1.x src/Driver/Database/sqlsrv/Schema.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Schema::createTechnicalPrimaryKeyIndexSql()
  3. 4.1.x src/Driver/Database/sqlsrv/Schema.php \Drupal\sqlsrv\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

src/Driver/Database/sqlsrv/Schema.php, line 1296

Class

Schema

Namespace

Drupal\sqlsrv\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);
}