You are here

public function Table::revert in Data 8

Revert a table to its definition in code.

Does not revert a table if it is not defined in code.

Return value

TRUE if the table was reverted, FALSE otherwise.

File

src/Table.php, line 529

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 revert() {
  if ($this->export_type & EXPORT_IN_CODE) {
    \Drupal::database()
      ->delete('data_tables')
      ->condition('name', $this->name)
      ->execute();
    return TRUE;
  }
  return FALSE;
}