function db_add_primary_key

Same name and namespace in other branches
  1. 6.x drupal-6.x/includes/database.pgsql.inc \db_add_primary_key()
  2. 6.x drupal-6.x/includes/database.mysql-common.inc \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

5 calls to db_add_primary_key()
field_sql_storage_update_7001 in drupal-7.x/modules/field/modules/field_sql_storage/field_sql_storage.install
Remove the field_config_entity_type table and store 'entity_type' strings.
field_sql_storage_update_7002 in drupal-7.x/modules/field/modules/field_sql_storage/field_sql_storage.install
Fix primary keys in field revision data tables.
search_update_7000 in drupal-7.x/modules/search/search.install
Replace unique keys in 'search_dataset' and 'search_index' by primary keys.
trigger_update_7000 in drupal-7.x/modules/trigger/trigger.install
Alter the "hook" field and drop the "op field" of {trigger_assignments}.
update_fix_d7_requirements in drupal-7.x/includes/update.inc
Perform Drupal 6.x to 7.x updates that are required for update.php to function properly.

Archivo

drupal-7.x/includes/database/database.inc, line 2890
Core systems for the database layer.

Código

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