You are here

protected function DatabaseSchema_sqlsrv::createTechnicalPrimaryColumn in Drupal driver for SQL Server and SQL Azure 7.2

Same name and namespace in other branches
  1. 7.3 sqlsrv/schema.inc \DatabaseSchema_sqlsrv::createTechnicalPrimaryColumn()
  2. 7 sqlsrv/schema.inc \DatabaseSchema_sqlsrv::createTechnicalPrimaryColumn()

Add a primary column to the table.

3 calls to DatabaseSchema_sqlsrv::createTechnicalPrimaryColumn()
DatabaseSchema_sqlsrv::addUniqueKey in sqlsrv/schema.inc
Override DatabaseSchema::addUniqueKey().
DatabaseSchema_sqlsrv::createTable in sqlsrv/schema.inc
{@Inheritdoc}
DatabaseSchema_sqlsrv::dropPrimaryKey in sqlsrv/schema.inc
Override DatabaseSchema::dropPrimaryKey().

File

sqlsrv/schema.inc, line 1545
Database schema code for Microsoft SQL Server database servers.

Class

DatabaseSchema_sqlsrv

Code

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