public function discoverFields() {
    if (!empty($this->fields)) {
      return; // Already configured.
    }

    $sm = $this->db()->getSchemaManager();
    $columns = $sm->listTableColumns($this->table);
    foreach ($columns as $column) {
      $this->fields[$column->getName()] = array(
        'name' => $column->getName(),
        'type' => $column->getType(),
      );
    }

    try {
      $this->fks = $sm->listTableForeignKeys($this->table);
    } catch (\DBALException $e) {
      //Platform does not support foreign keys.
      $this->fks = array();
    }
  }