function db_add_primary_key
Same name in other branches
- 8.9.x core/includes/database.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
6 calls to db_add_primary_key()
- field_sql_storage_update_7001 in 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 modules/
field/ modules/ field_sql_storage/ field_sql_storage.install - Fix primary keys in field revision data tables.
- node_update_7016 in modules/
node/ node.install - Change {history}.nid to an unsigned int in order to match {node}.nid.
- search_update_7000 in modules/
search/ search.install - Replace unique keys in 'search_dataset' and 'search_index' by primary keys.
- trigger_update_7000 in modules/
trigger/ trigger.install - Alter the "hook" field and drop the "op field" of {trigger_assignments}.
File
-
includes/
database/ database.inc, line 3026
Code
function db_add_primary_key($table, $fields) {
return Database::getConnection()->schema()
->addPrimaryKey($table, $fields);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.