You are here

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

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

Add a primary column to the table.

2 calls to DatabaseSchema_sqlsrv::createTechnicalPrimaryColumn()
DatabaseSchema_sqlsrv::addUniqueKey in sqlsrv/schema.inc
Override DatabaseSchema::addUniqueKey().
DatabaseSchema_sqlsrv::dropPrimaryKey in sqlsrv/schema.inc
Override DatabaseSchema::dropPrimaryKey().

File

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

Class

DatabaseSchema_sqlsrv

Code

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