public function Table::changePrimaryKey in Data 8
Change the primary keys of a table.
Throws
File
- src/
Table.php, line 432
Class
- Table
- Manages data access and manipulation for a single data table. Use data_create_table() or data_get_table() to instantiate an object from this class.
Namespace
Drupal\dataCode
public function changePrimaryKey($fields) {
$schema = $this->table_schema;
if (!empty($schema['primary key'])) {
$this
->dropPrimaryKey();
}
if (!empty($fields)) {
$this
->addPrimaryKey($fields);
}
}