1 database.inc db_add_primary_key($table, array $fields)

Adds a primary key to a database table.

Parameters

string $table: Name of the table to be altered.

array $fields: Array of fields for the primary key.

Return value

void:

Related topics

File

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

Code

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