You are here

public function SqlServerSchemaTest::testPrimaryKeyAlter in Drupal driver for SQL Server and SQL Azure 7.3

Same name and namespace in other branches
  1. 7 tests/sqlsrv.schema.test \SqlServerSchemaTest::testPrimaryKeyAlter()
  2. 7.2 tests/sqlsrv.schema.test \SqlServerSchemaTest::testPrimaryKeyAlter()

Test altering a primary key.

File

tests/sqlsrv.schema.test, line 63
Support tests for SQL Server.

Class

SqlServerSchemaTest
@file Support tests for SQL Server.

Code

public function testPrimaryKeyAlter() {
  $table_spec = array(
    'fields' => array(
      'id' => array(
        'type' => 'int',
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  db_create_table('test_table', $table_spec);

  // Add a default value.
  db_change_field('test_table', 'id', 'id', array(
    'type' => 'int',
    'not null' => TRUE,
    'default' => 1,
  ));
}