You are here

public function Table::dropPrimaryKey in Data 8

Drop all primary keys from a table.

Throws

DataException

1 call to Table::dropPrimaryKey()
Table::changePrimaryKey in src/Table.php
Change the primary keys of a table.

File

src/Table.php, line 417

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\data

Code

public function dropPrimaryKey() {
  \Drupal::database()
    ->schema()
    ->dropPrimaryKey($this->name);
  $schema = $this->table_schema;
  $schema['primary key'] = array();
  $this
    ->update(array(
    'table_schema' => $schema,
  ));
  drupal_get_schema($this->name, TRUE);
  return;
}