function DatabaseSchema::addPrimaryKey

Add a primary key.

Parameters

$table: The table to be altered.

$fields: Fields for the primary key.

Throws

DatabaseSchemaObjectDoesNotExistException If the specified table doesn't exist.

DatabaseSchemaObjectExistsException If the specified table already has a primary key.

3 methods override DatabaseSchema::addPrimaryKey()
DatabaseSchema_mysql::addPrimaryKey in includes/database/mysql/schema.inc
Add a primary key.
DatabaseSchema_pgsql::addPrimaryKey in includes/database/pgsql/schema.inc
Add a primary key.
DatabaseSchema_sqlite::addPrimaryKey in includes/database/sqlite/schema.inc
Add a primary key.

File

includes/database/schema.inc, line 575

Class

DatabaseSchema
Base class for database schema definitions.

Code

public abstract function addPrimaryKey($table, $fields);

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.