SET standard_conforming_strings = off;
SET escape_string_warning = off;
-- MySQL dump 10.11
--
-- Host: vegbiendev.nceas.ucsb.edu    Database: VegCore
-- ------------------------------------------------------
-- Server version	5.5.31-0ubuntu0.12.04.1
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,POSTGRESQL' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table "aggregate_observation"
--

CREATE TABLE "aggregate_observation" (
  "id" bytea NOT NULL,
  "taxon_concept" bytea NOT NULL,
  "traits" hstore DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*KEY "fk_aggregate_observation_taxon_name1_idx" ("taxon_concept")*/CHECK (true),
  /*CONSTRAINT "fk_aggregate_observation_taxon_name1" FOREIGN KEY ("taxon_concept") REFERENCES "taxon_concept" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_aggregate_observation_taxon_occurrence1" FOREIGN KEY ("id") REFERENCES "taxon_observation" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "aggregate_observation"
--

/*!40000 ALTER TABLE "aggregate_observation" DISABLE KEYS */;
/*!40000 ALTER TABLE "aggregate_observation" ENABLE KEYS */;

--
-- Table structure for table "base_class"
--

CREATE TABLE "base_class" (
  "id" bytea NOT NULL,
  "referenced_class" bytea NOT NULL,
  PRIMARY KEY ("id"),
  /*KEY "fk_base_class_referenced_class1_idx" ("referenced_class")*/CHECK (true),
  /*CONSTRAINT "fk_base_class_referenced_class1" FOREIGN KEY ("referenced_class") REFERENCES "referenced_class" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_example_record1" FOREIGN KEY ("id") REFERENCES "record" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "base_class"
--

/*!40000 ALTER TABLE "base_class" DISABLE KEYS */;
/*!40000 ALTER TABLE "base_class" ENABLE KEYS */;

--
-- Table structure for table "collection"
--

CREATE TABLE "collection" (
  "id" bytea NOT NULL,
  "institution" bytea NOT NULL,
  "name" bytea NOT NULL,
  PRIMARY KEY ("id"),
  /*CONSTRAINT "collection_unique" */UNIQUE ("institution","name"),
  /*KEY "fk_collection_organization1_idx" ("institution")*/CHECK (true),
  /*KEY "fk_collection_source1_idx" ("id")*/CHECK (true),
  /*CONSTRAINT "fk_collection_organization1" FOREIGN KEY ("institution") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_collection_source1" FOREIGN KEY ("id") REFERENCES "record" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "collection"
--

/*!40000 ALTER TABLE "collection" DISABLE KEYS */;
/*!40000 ALTER TABLE "collection" ENABLE KEYS */;

--
-- Table structure for table "community"
--

CREATE TABLE "community" (
  "id" bytea NOT NULL,
  "name" bytea NOT NULL,
  "info" hstore DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*CONSTRAINT "fk_community_record1" FOREIGN KEY ("id") REFERENCES "record" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "community"
--

/*!40000 ALTER TABLE "community" DISABLE KEYS */;
/*!40000 ALTER TABLE "community" ENABLE KEYS */;

--
-- Table structure for table "coordinates"
--

CREATE TABLE "coordinates" (
  "id" bytea NOT NULL,
  "latitude_deg" bytea DEFAULT NULL,
  "longitude_deg" bytea DEFAULT NULL,
  PRIMARY KEY ("id")
);

--
-- Dumping data for table "coordinates"
--

/*!40000 ALTER TABLE "coordinates" DISABLE KEYS */;
/*!40000 ALTER TABLE "coordinates" ENABLE KEYS */;

--
-- Table structure for table "derived_class"
--

CREATE TABLE "derived_class" (
  "id" bytea NOT NULL,
  PRIMARY KEY ("id"),
  /*CONSTRAINT "fk_derived_class_base_class1" FOREIGN KEY ("id") REFERENCES "base_class" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "derived_class"
--

/*!40000 ALTER TABLE "derived_class" DISABLE KEYS */;
/*!40000 ALTER TABLE "derived_class" ENABLE KEYS */;

--
-- Table structure for table "event"
--

CREATE TABLE "event" (
  "id" bytea NOT NULL,
  "parent" bytea NOT NULL,
  "name" bytea DEFAULT NULL,
  "date_range" bytea DEFAULT NULL,
  "place" bytea DEFAULT NULL,
  "method" bytea DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*KEY "fk_event_place1_idx" ("place")*/CHECK (true),
  /*KEY "fk_event1_idx" ("parent")*/CHECK (true),
  /*KEY "fk_event_method1_idx" ("method")*/CHECK (true),
  /*CONSTRAINT "fk_event1" FOREIGN KEY ("parent") REFERENCES "event" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_event_method1" FOREIGN KEY ("method") REFERENCES "method" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_event_place1" FOREIGN KEY ("place") REFERENCES "place" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_event_record1" FOREIGN KEY ("id") REFERENCES "record" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "event"
--

/*!40000 ALTER TABLE "event" DISABLE KEYS */;
/*!40000 ALTER TABLE "event" ENABLE KEYS */;

--
-- Table structure for table "event_participant"
--

CREATE TABLE "event_participant" (
  "event" bytea NOT NULL,
  "party" bytea NOT NULL,
  "sort_order" integer DEFAULT NULL,
  PRIMARY KEY ("event","party"),
  /*KEY "fk_event_has_party_party1_idx" ("party")*/CHECK (true),
  /*KEY "fk_event_has_party_event1_idx" ("event")*/CHECK (true),
  /*CONSTRAINT "fk_event_has_party_event1" FOREIGN KEY ("event") REFERENCES "event" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_event_has_party_party1" FOREIGN KEY ("party") REFERENCES "party" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "event_participant"
--

/*!40000 ALTER TABLE "event_participant" DISABLE KEYS */;
/*!40000 ALTER TABLE "event_participant" ENABLE KEYS */;

--
-- Table structure for table "geological_context"
--

CREATE TABLE "geological_context" (
  "id" bytea NOT NULL,
  "name" bytea NOT NULL,
  "info" hstore DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*CONSTRAINT "fk_geological_context_record1" FOREIGN KEY ("id") REFERENCES "record" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "geological_context"
--

/*!40000 ALTER TABLE "geological_context" DISABLE KEYS */;
/*!40000 ALTER TABLE "geological_context" ENABLE KEYS */;

--
-- Table structure for table "geovalidation"
--

CREATE TABLE "geovalidation" (
  "id" bytea NOT NULL,
  "geovalid" integer NOT NULL,
  "lat_long_domain_valid" integer NOT NULL,
  "lat_long_in_ranks" hstore DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*CONSTRAINT "fk_geovalidation_validatable_place1" FOREIGN KEY ("id") REFERENCES "validatable_place" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "geovalidation"
--

/*!40000 ALTER TABLE "geovalidation" DISABLE KEYS */;
/*!40000 ALTER TABLE "geovalidation" ENABLE KEYS */;

--
-- Table structure for table "individual"
--

CREATE TABLE "individual" (
  "id" bytea NOT NULL,
  "tag" bytea DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*CONSTRAINT "fk_individual_record1" FOREIGN KEY ("id") REFERENCES "taxon_occurrence" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "individual"
--

/*!40000 ALTER TABLE "individual" DISABLE KEYS */;
/*!40000 ALTER TABLE "individual" ENABLE KEYS */;

--
-- Table structure for table "individual_observation"
--

CREATE TABLE "individual_observation" (
  "id" bytea NOT NULL,
  "individual" bytea DEFAULT NULL,
  "code" bytea DEFAULT NULL,
  "traits" hstore DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*KEY "fk_individual_observation_individual1_idx" ("individual")*/CHECK (true),
  /*CONSTRAINT "fk_individual_observation_individual1" FOREIGN KEY ("individual") REFERENCES "individual" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_individual_observation_taxon_occurrence1" FOREIGN KEY ("id") REFERENCES "taxon_observation" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "individual_observation"
--

/*!40000 ALTER TABLE "individual_observation" DISABLE KEYS */;
/*!40000 ALTER TABLE "individual_observation" ENABLE KEYS */;

--
-- Table structure for table "method"
--

CREATE TABLE "method" (
  "id" bytea NOT NULL,
  "parent" bytea NOT NULL,
  "info" hstore DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*KEY "fk_method_method1_idx" ("parent")*/CHECK (true),
  /*CONSTRAINT "fk_method_method1" FOREIGN KEY ("parent") REFERENCES "method" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_method_record1" FOREIGN KEY ("id") REFERENCES "record" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "method"
--

/*!40000 ALTER TABLE "method" DISABLE KEYS */;
/*!40000 ALTER TABLE "method" ENABLE KEYS */;

--
-- Table structure for table "organization"
--

CREATE TABLE "organization" (
  "id" bytea NOT NULL,
  "info" hstore DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*CONSTRAINT "fk_organization_party1" FOREIGN KEY ("id") REFERENCES "party" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "organization"
--

/*!40000 ALTER TABLE "organization" DISABLE KEYS */;
/*!40000 ALTER TABLE "organization" ENABLE KEYS */;

--
-- Table structure for table "parsed_taxon_assertion"
--

CREATE TABLE "parsed_taxon_assertion" (
  "id" bytea NOT NULL,
  "matched_taxon_concept" bytea DEFAULT NULL,
  "match_score" float DEFAULT NULL,
  "match_info" hstore DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*KEY "fk_parsed_taxon_assertion_taxon_name1_idx" ("matched_taxon_concept")*/CHECK (true),
  /*CONSTRAINT "fk_matched_taxon_qualified_taxon10" FOREIGN KEY ("id") REFERENCES "taxon_assertion" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_parsed_taxon_assertion_taxon_name1" FOREIGN KEY ("matched_taxon_concept") REFERENCES "taxon_concept" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "parsed_taxon_assertion"
--

/*!40000 ALTER TABLE "parsed_taxon_assertion" DISABLE KEYS */;
/*!40000 ALTER TABLE "parsed_taxon_assertion" ENABLE KEYS */;

--
-- Table structure for table "party"
--

CREATE TABLE "party" (
  "id" bytea NOT NULL,
  "info" hstore DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*CONSTRAINT "fk_collection_source10" FOREIGN KEY ("id") REFERENCES "record" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "party"
--

/*!40000 ALTER TABLE "party" DISABLE KEYS */;
/*!40000 ALTER TABLE "party" ENABLE KEYS */;

--
-- Table structure for table "place"
--

CREATE TABLE "place" (
  "id" bytea NOT NULL,
  "parent" bytea NOT NULL,
  "coordinates" bytea DEFAULT NULL,
  "path" bytea DEFAULT NULL,
  "locality" bytea DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*KEY "fk_place_coordinates1_idx" ("coordinates")*/CHECK (true),
  /*KEY "fk_place1_idx" ("parent")*/CHECK (true),
  /*KEY "fk_place_place_path1_idx" ("path")*/CHECK (true),
  /*CONSTRAINT "fk_place1" FOREIGN KEY ("parent") REFERENCES "place" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_place_coordinates1" FOREIGN KEY ("coordinates") REFERENCES "coordinates" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_place_place_path1" FOREIGN KEY ("path") REFERENCES "place_path" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_place_record1" FOREIGN KEY ("id") REFERENCES "record" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "place"
--

/*!40000 ALTER TABLE "place" DISABLE KEYS */;
/*!40000 ALTER TABLE "place" ENABLE KEYS */;

--
-- Table structure for table "place_observation"
--

CREATE TABLE "place_observation" (
  "id" bytea NOT NULL,
  "place" bytea NOT NULL,
  "elevation_m" double precision DEFAULT NULL,
  "slope_incline_deg" double precision DEFAULT NULL,
  "slope_direction_deg_N" double precision DEFAULT NULL,
  "geological_context" bytea DEFAULT NULL,
  "community" bytea DEFAULT NULL,
  "observations" hstore DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*KEY "fk_place_observation_place1_idx" ("place")*/CHECK (true),
  /*KEY "fk_place_observation_geological_context1_idx" ("geological_context")*/CHECK (true),
  /*KEY "fk_place_observation_community1_idx" ("community")*/CHECK (true),
  /*KEY "fk_place_observation_event1_idx" ("id")*/CHECK (true),
  /*CONSTRAINT "fk_place_observation_community1" FOREIGN KEY ("community") REFERENCES "community" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_place_observation_event1" FOREIGN KEY ("id") REFERENCES "event" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_place_observation_geological_context1" FOREIGN KEY ("geological_context") REFERENCES "geological_context" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_place_observation_place1" FOREIGN KEY ("place") REFERENCES "place" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "place_observation"
--

/*!40000 ALTER TABLE "place_observation" DISABLE KEYS */;
/*!40000 ALTER TABLE "place_observation" ENABLE KEYS */;

--
-- Table structure for table "place_path"
--

CREATE TABLE "place_path" (
  "id" bytea NOT NULL,
  "continent" bytea DEFAULT NULL,
  "country" bytea DEFAULT NULL,
  "state_province" bytea DEFAULT NULL,
  "county" bytea DEFAULT NULL,
  "municipality" bytea DEFAULT NULL,
  "ranks" hstore DEFAULT NULL,
  PRIMARY KEY ("id")
);

--
-- Dumping data for table "place_path"
--

/*!40000 ALTER TABLE "place_path" DISABLE KEYS */;
/*!40000 ALTER TABLE "place_path" ENABLE KEYS */;

--
-- Table structure for table "plot"
--

CREATE TABLE "plot" (
  "id" bytea NOT NULL,
  "name" bytea DEFAULT NULL,
  "area_m2" double precision DEFAULT NULL,
  "bounding_box" bytea DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*CONSTRAINT "fk_subplot_place1" FOREIGN KEY ("id") REFERENCES "place" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "plot"
--

/*!40000 ALTER TABLE "plot" DISABLE KEYS */;
/*!40000 ALTER TABLE "plot" ENABLE KEYS */;

--
-- Table structure for table "project"
--

CREATE TABLE "project" (
  "id" bytea NOT NULL,
  "name" bytea NOT NULL,
  "info" hstore DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*CONSTRAINT "fk_project_event1" FOREIGN KEY ("id") REFERENCES "event" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "project"
--

/*!40000 ALTER TABLE "project" DISABLE KEYS */;
/*!40000 ALTER TABLE "project" ENABLE KEYS */;

--
-- Table structure for table "record"
--

CREATE TABLE "record" (
  "id" bytea NOT NULL,
  "source" bytea NOT NULL,
  "source_id_scope" bytea DEFAULT NULL,
  "source_record_id" bytea DEFAULT NULL,
  "info" hstore DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*CONSTRAINT "record_unique" */UNIQUE ("source","source_id_scope","source_record_id"),
  /*KEY "fk_record_source1_idx" ("source")*/CHECK (true),
  /*CONSTRAINT "fk_record_source1" FOREIGN KEY ("source") REFERENCES "source" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "record"
--

/*!40000 ALTER TABLE "record" DISABLE KEYS */;
/*!40000 ALTER TABLE "record" ENABLE KEYS */;

--
-- Table structure for table "referenced_class"
--

CREATE TABLE "referenced_class" (
  "id" bytea NOT NULL,
  PRIMARY KEY ("id"),
  /*CONSTRAINT "fk_example_record10" FOREIGN KEY ("id") REFERENCES "record" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "referenced_class"
--

/*!40000 ALTER TABLE "referenced_class" DISABLE KEYS */;
/*!40000 ALTER TABLE "referenced_class" ENABLE KEYS */;

--
-- Table structure for table "relationship"
--

CREATE TABLE "relationship" (
  "id" bytea NOT NULL,
  "record" bytea NOT NULL,
  "related_record" bytea NOT NULL,
  "info" hstore DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*KEY "fk_relationship_record1_idx" ("record")*/CHECK (true),
  /*KEY "fk_relationship_related_record_idx" ("related_record")*/CHECK (true),
  /*CONSTRAINT "fk_relationship_record1" FOREIGN KEY ("id") REFERENCES "record" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_relationship_record2" FOREIGN KEY ("record") REFERENCES "record" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_relationship_related_record" FOREIGN KEY ("related_record") REFERENCES "record" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "relationship"
--

/*!40000 ALTER TABLE "relationship" DISABLE KEYS */;
/*!40000 ALTER TABLE "relationship" ENABLE KEYS */;

--
-- Table structure for table "soil_observation"
--

CREATE TABLE "soil_observation" (
  "id" bytea NOT NULL,
  "observations" hstore DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*CONSTRAINT "fk_soil_observation_place_observation1" FOREIGN KEY ("id") REFERENCES "place_observation" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "soil_observation"
--

/*!40000 ALTER TABLE "soil_observation" DISABLE KEYS */;
/*!40000 ALTER TABLE "soil_observation" ENABLE KEYS */;

--
-- Table structure for table "source"
--

CREATE TABLE "source" (
  "id" bytea NOT NULL,
  "parent" bytea NOT NULL,
  "name" bytea NOT NULL,
  "first_publisher" bytea DEFAULT NULL,
  "owner" bytea DEFAULT NULL,
  "info" hstore DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*CONSTRAINT "source_unique" */UNIQUE ("parent","name"),
  /*KEY "fk_source1_idx" ("parent")*/CHECK (true),
  /*KEY "fk_source_party2_idx" ("first_publisher")*/CHECK (true),
  /*KEY "fk_source_party1_idx" ("owner")*/CHECK (true),
  /*CONSTRAINT "fk_source1" FOREIGN KEY ("parent") REFERENCES "source" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_source_party1" FOREIGN KEY ("owner") REFERENCES "party" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_source_party2" FOREIGN KEY ("first_publisher") REFERENCES "party" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "source"
--

/*!40000 ALTER TABLE "source" DISABLE KEYS */;
/*!40000 ALTER TABLE "source" ENABLE KEYS */;

--
-- Table structure for table "specimen"
--

CREATE TABLE "specimen" (
  "id" bytea NOT NULL,
  "individual" bytea DEFAULT NULL,
  "code_in_individual" bytea DEFAULT NULL,
  "collection_event" bytea DEFAULT NULL,
  "orig_collection" bytea DEFAULT NULL,
  "barcode" bytea DEFAULT NULL,
  "accession_number" bytea DEFAULT NULL,
  "current_collection" bytea DEFAULT NULL,
  "owner_collection" bytea DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*CONSTRAINT "specimen_unique_in_individual" */UNIQUE ("individual","code_in_individual"),
  /*CONSTRAINT "specimen_unique_by_collection_event" */UNIQUE ("collection_event"),
  /*CONSTRAINT "specimen_unique_in_collection_by_barcode" */UNIQUE ("orig_collection","barcode"),
  /*CONSTRAINT "specimen_unique_in_collection_by_accession_number" */UNIQUE ("orig_collection","accession_number"),
  /*KEY "fk_specimen_collection1_idx" ("orig_collection")*/CHECK (true),
  /*KEY "fk_specimen_taxon_observation1_idx" ("collection_event")*/CHECK (true),
  /*KEY "fk_specimen_individual1_idx" ("individual")*/CHECK (true),
  /*KEY "fk_specimen_collection2_idx" ("current_collection")*/CHECK (true),
  /*KEY "fk_specimen_organization3_idx" ("owner_collection")*/CHECK (true),
  /*CONSTRAINT "fk_specimen_collection1" FOREIGN KEY ("orig_collection") REFERENCES "collection" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_specimen_collection2" FOREIGN KEY ("current_collection") REFERENCES "collection" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_specimen_individual1" FOREIGN KEY ("individual") REFERENCES "individual" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_specimen_organization3" FOREIGN KEY ("owner_collection") REFERENCES "collection" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_specimen_taxon_observation1" FOREIGN KEY ("collection_event") REFERENCES "taxon_observation" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_specimen_taxon_occurrence1" FOREIGN KEY ("id") REFERENCES "taxon_occurrence" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "specimen"
--

/*!40000 ALTER TABLE "specimen" DISABLE KEYS */;
/*!40000 ALTER TABLE "specimen" ENABLE KEYS */;

--
-- Table structure for table "specimen_observation"
--

CREATE TABLE "specimen_observation" (
  "id" bytea NOT NULL,
  "specimen" bytea NOT NULL,
  "traits" hstore DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*KEY "fk_specimen_observation_specimen1_idx" ("specimen")*/CHECK (true),
  /*CONSTRAINT "fk_specimen_observation_specimen1" FOREIGN KEY ("specimen") REFERENCES "specimen" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_specimen_taxon_occurrence10" FOREIGN KEY ("id") REFERENCES "taxon_observation" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "specimen_observation"
--

/*!40000 ALTER TABLE "specimen_observation" DISABLE KEYS */;
/*!40000 ALTER TABLE "specimen_observation" ENABLE KEYS */;

--
-- Table structure for table "stem"
--

CREATE TABLE "stem" (
  "id" bytea NOT NULL,
  "individual" bytea NOT NULL,
  PRIMARY KEY ("id"),
  /*KEY "fk_stem_individual1_idx" ("individual")*/CHECK (true),
  /*CONSTRAINT "fk_stem_individual1" FOREIGN KEY ("individual") REFERENCES "individual" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_stem_individual2" FOREIGN KEY ("id") REFERENCES "individual" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "stem"
--

/*!40000 ALTER TABLE "stem" DISABLE KEYS */;
/*!40000 ALTER TABLE "stem" ENABLE KEYS */;

--
-- Table structure for table "stem_observation"
--

CREATE TABLE "stem_observation" (
  "id" bytea NOT NULL,
  "individual_observation" bytea NOT NULL,
  "stem" bytea DEFAULT NULL,
  "traits" hstore DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*CONSTRAINT "stem_observation_unique" */UNIQUE ("individual_observation","stem"),
  /*KEY "fk_stem_observation_individual_observation1_idx" ("individual_observation")*/CHECK (true),
  /*KEY "fk_stem_observation_stem1_idx" ("stem")*/CHECK (true),
  /*CONSTRAINT "fk_stem_observation_individual_observation1" FOREIGN KEY ("individual_observation") REFERENCES "individual_observation" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_stem_observation_individual_observation2" FOREIGN KEY ("id") REFERENCES "individual_observation" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_stem_observation_stem1" FOREIGN KEY ("stem") REFERENCES "stem" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "stem_observation"
--

/*!40000 ALTER TABLE "stem_observation" DISABLE KEYS */;
/*!40000 ALTER TABLE "stem_observation" ENABLE KEYS */;

--
-- Table structure for table "stratum"
--

CREATE TABLE "stratum" (
  "id" bytea NOT NULL,
  "name" bytea NOT NULL,
  "info" hstore DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*CONSTRAINT "fk_place_path_record10" FOREIGN KEY ("id") REFERENCES "method" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "stratum"
--

/*!40000 ALTER TABLE "stratum" DISABLE KEYS */;
/*!40000 ALTER TABLE "stratum" ENABLE KEYS */;

--
-- Table structure for table "subplot"
--

CREATE TABLE "subplot" (
  "id" bytea NOT NULL,
  "x_m" double precision DEFAULT NULL,
  "y_m" double precision DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*CONSTRAINT "fk_subplot_plot1" FOREIGN KEY ("id") REFERENCES "plot" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "subplot"
--

/*!40000 ALTER TABLE "subplot" DISABLE KEYS */;
/*!40000 ALTER TABLE "subplot" ENABLE KEYS */;

--
-- Table structure for table "taxon_assertion"
--

CREATE TABLE "taxon_assertion" (
  "id" bytea NOT NULL,
  "string" bytea NOT NULL,
  "taxon" bytea DEFAULT NULL,
  "cf_aff" bytea DEFAULT NULL,
  "annotations" hstore DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*KEY "fk_taxon_assertion_taxon_string1_idx" ("string")*/CHECK (true),
  /*KEY "fk_taxon_assertion_taxon_name1_idx" ("taxon")*/CHECK (true),
  /*CONSTRAINT "fk_qualified_taxon_record1" FOREIGN KEY ("id") REFERENCES "record" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_taxon_assertion_taxon_name1" FOREIGN KEY ("taxon") REFERENCES "taxon_name" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_taxon_assertion_taxon_string1" FOREIGN KEY ("string") REFERENCES "taxon_string" ("string") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "taxon_assertion"
--

/*!40000 ALTER TABLE "taxon_assertion" DISABLE KEYS */;
/*!40000 ALTER TABLE "taxon_assertion" ENABLE KEYS */;

--
-- Table structure for table "taxon_concept"
--

CREATE TABLE "taxon_concept" (
  "id" bytea NOT NULL,
  "according_to" bytea NOT NULL,
  "parent" bytea NOT NULL,
  "accepted_taxon_concept" bytea DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*CONSTRAINT "taxon_concept_unique_name" */UNIQUE ("according_to"),
  /*KEY "fk_taxon_taxon1_idx" ("parent")*/CHECK (true),
  /*KEY "fk_taxon_concept_source1_idx" ("according_to")*/CHECK (true),
  /*KEY "fk_taxon_concept_taxon_concept1_idx" ("accepted_taxon_concept")*/CHECK (true),
  /*CONSTRAINT "fk_taxon_concept_source1" FOREIGN KEY ("according_to") REFERENCES "source" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_taxon_concept_taxon_concept1" FOREIGN KEY ("accepted_taxon_concept") REFERENCES "taxon_concept" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_taxon_concept_taxon_name1" FOREIGN KEY ("id") REFERENCES "taxon_name" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_taxon_taxon1" FOREIGN KEY ("parent") REFERENCES "taxon_concept" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "taxon_concept"
--

/*!40000 ALTER TABLE "taxon_concept" DISABLE KEYS */;
/*!40000 ALTER TABLE "taxon_concept" ENABLE KEYS */;

--
-- Table structure for table "taxon_determination"
--

CREATE TABLE "taxon_determination" (
  "id" bytea NOT NULL,
  "taxon_assertion" bytea NOT NULL,
  "identified_by" bytea DEFAULT NULL,
  "fit_info" hstore DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*CONSTRAINT "taxon_determination_unique" */UNIQUE ("taxon_assertion","identified_by"),
  /*KEY "fk_taxon_occurrence_has_qualified_taxon1_idx" ("taxon_assertion")*/CHECK (true),
  /*KEY "fk_taxon_determination_party1_idx" ("identified_by")*/CHECK (true),
  /*CONSTRAINT "fk_taxon_determination_party1" FOREIGN KEY ("identified_by") REFERENCES "party" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_taxon_determination_record1" FOREIGN KEY ("id") REFERENCES "taxon_observation" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_taxon_occurrence_has_qualified_taxon1" FOREIGN KEY ("taxon_assertion") REFERENCES "taxon_assertion" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "taxon_determination"
--

/*!40000 ALTER TABLE "taxon_determination" DISABLE KEYS */;
/*!40000 ALTER TABLE "taxon_determination" ENABLE KEYS */;

--
-- Table structure for table "taxon_name"
--

CREATE TABLE "taxon_name" (
  "id" bytea NOT NULL,
  "unique_name" bytea NOT NULL,
  "formal_name" bytea DEFAULT NULL,
  "taxon_name" bytea DEFAULT NULL,
  "author" bytea DEFAULT NULL,
  "common_name" bytea DEFAULT NULL,
  "rank" bytea DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*KEY "fk_taxon_concept_taxon_string10_idx" ("unique_name")*/CHECK (true),
  /*CONSTRAINT "fk_taxon_concept_taxon_string10" FOREIGN KEY ("unique_name") REFERENCES "taxon_string" ("string") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_taxon_record10" FOREIGN KEY ("id") REFERENCES "record" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "taxon_name"
--

/*!40000 ALTER TABLE "taxon_name" DISABLE KEYS */;
/*!40000 ALTER TABLE "taxon_name" ENABLE KEYS */;

--
-- Table structure for table "taxon_observation"
--

CREATE TABLE "taxon_observation" (
  "id" bytea NOT NULL,
  "taxon_occurrence" bytea NOT NULL,
  "collector" bytea DEFAULT NULL,
  "collector_number" bytea DEFAULT NULL,
  "voucher" bytea DEFAULT NULL,
  "growth_form" bytea DEFAULT NULL,
  "cultivated" integer DEFAULT NULL,
  "traits" hstore DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*KEY "fk_taxon_observation_taxon_occurrence2_idx" ("taxon_occurrence")*/CHECK (true),
  /*KEY "fk_taxon_observation_specimen1_idx" ("voucher")*/CHECK (true),
  /*KEY "fk_taxon_observation_party1_idx" ("collector")*/CHECK (true),
  /*CONSTRAINT "fk_taxon_observation_event1" FOREIGN KEY ("id") REFERENCES "event" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_taxon_observation_party1" FOREIGN KEY ("collector") REFERENCES "party" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_taxon_observation_specimen1" FOREIGN KEY ("voucher") REFERENCES "specimen" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_taxon_observation_taxon_occurrence2" FOREIGN KEY ("taxon_occurrence") REFERENCES "taxon_occurrence" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "taxon_observation"
--

/*!40000 ALTER TABLE "taxon_observation" DISABLE KEYS */;
/*!40000 ALTER TABLE "taxon_observation" ENABLE KEYS */;

--
-- Table structure for table "taxon_occurrence"
--

CREATE TABLE "taxon_occurrence" (
  "id" bytea NOT NULL,
  "current_determination" bytea DEFAULT NULL,
  "original_determination" bytea DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*KEY "fk_taxon_occurrence_taxon_determination1_idx" ("original_determination")*/CHECK (true),
  /*KEY "fk_taxon_occurrence_taxon_determination2_idx" ("current_determination")*/CHECK (true),
  /*CONSTRAINT "fk_taxon_occurrence_event1" FOREIGN KEY ("id") REFERENCES "record" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_taxon_occurrence_taxon_determination1" FOREIGN KEY ("original_determination") REFERENCES "taxon_determination" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_taxon_occurrence_taxon_determination2" FOREIGN KEY ("current_determination") REFERENCES "taxon_determination" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "taxon_occurrence"
--

/*!40000 ALTER TABLE "taxon_occurrence" DISABLE KEYS */;
/*!40000 ALTER TABLE "taxon_occurrence" ENABLE KEYS */;

--
-- Table structure for table "taxon_path"
--

CREATE TABLE "taxon_path" (
  "id" bytea NOT NULL,
  "family" bytea DEFAULT NULL,
  "genus" bytea DEFAULT NULL,
  "specific_epithet" bytea DEFAULT NULL,
  "ranks" hstore DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*CONSTRAINT "fk_taxon_path_taxon_name1" FOREIGN KEY ("id") REFERENCES "taxon_name" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "taxon_path"
--

/*!40000 ALTER TABLE "taxon_path" DISABLE KEYS */;
/*!40000 ALTER TABLE "taxon_path" ENABLE KEYS */;

--
-- Table structure for table "taxon_presence"
--

CREATE TABLE "taxon_presence" (
  "id" bytea NOT NULL,
  "taxon_concept" bytea NOT NULL,
  "traits" hstore DEFAULT NULL,
  PRIMARY KEY ("id"),
  /*KEY "fk_taxon_presence_taxon_name1_idx" ("taxon_concept")*/CHECK (true),
  /*CONSTRAINT "fk_taxon_observation_taxon_occurrence1" FOREIGN KEY ("id") REFERENCES "taxon_observation" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_taxon_presence_taxon_name1" FOREIGN KEY ("taxon_concept") REFERENCES "taxon_concept" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "taxon_presence"
--

/*!40000 ALTER TABLE "taxon_presence" DISABLE KEYS */;
/*!40000 ALTER TABLE "taxon_presence" ENABLE KEYS */;

--
-- Table structure for table "taxon_string"
--

CREATE TABLE "taxon_string" (
  "string" bytea NOT NULL,
  "parsed_taxon_assertion" bytea DEFAULT NULL,
  PRIMARY KEY ("string"),
  /*KEY "fk_taxon_string_parsed_taxon_assertion1_idx" ("parsed_taxon_assertion")*/CHECK (true),
  /*CONSTRAINT "fk_taxon_string_parsed_taxon_assertion1" FOREIGN KEY ("parsed_taxon_assertion") REFERENCES "parsed_taxon_assertion" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "taxon_string"
--

/*!40000 ALTER TABLE "taxon_string" DISABLE KEYS */;
/*!40000 ALTER TABLE "taxon_string" ENABLE KEYS */;

--
-- Table structure for table "validatable_place"
--

CREATE TABLE "validatable_place" (
  "id" bytea NOT NULL,
  "coordinates" bytea NOT NULL,
  "path" bytea NOT NULL,
  PRIMARY KEY ("id"),
  /*CONSTRAINT "validatable_place_unique" */UNIQUE ("path","coordinates"),
  /*KEY "fk_geovalidation_place_path1_idx" ("path")*/CHECK (true),
  /*KEY "fk_geovalidation_coordinates1_idx" ("coordinates")*/CHECK (true),
  /*CONSTRAINT "fk_geovalidation_coordinates1" FOREIGN KEY ("coordinates") REFERENCES "coordinates" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
  /*CONSTRAINT "fk_geovalidation_place_path1" FOREIGN KEY ("path") REFERENCES "place_path" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
);

--
-- Dumping data for table "validatable_place"
--

/*!40000 ALTER TABLE "validatable_place" DISABLE KEYS */;
/*!40000 ALTER TABLE "validatable_place" ENABLE KEYS */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed
