function db_add_primary_key

Adds a primary key to a database table.

Parameters

$table: Name of the table to be altered.

$fields: Array of fields for the primary key.

Related topics

2 calls to db_add_primary_key()
field_sql_storage_update_8000 in drupal/core/modules/field/modules/field_sql_storage/field_sql_storage.install
Changes field language into langcode.
locale_update_8005 in drupal/core/modules/locale/locale.install
Update plural interface translations to new format.

File

drupal/core/includes/database.inc, line 763
Core systems for the database layer.

Code

function db_add_primary_key($table, $fields) {
  return Database::getConnection()
    ->schema()
    ->addPrimaryKey($table, $fields);
}