

-- Generated by Relational Schema Center on Fri Sep 22 15:46:15 PDT 2006 for DB2 Universal Database V8.2


CREATE SCHEMA TBASE2;

CREATE TABLE TBASE2.ALGORITHM
  (TYPE CHARACTER(1) NOT NULL,
   ALGORITHM_ID BIGINT NOT NULL,
   VERSION INTEGER,
   PROPERTYVALUE VARCHAR(255),
   PROPERTYNAME VARCHAR(255),
   DESCRIPTION VARCHAR(2000),
   POLYTCOUNT_ID BIGINT,
   GAPMODE_ID BIGINT,
   USERTYPE_ID BIGINT);

ALTER TABLE TBASE2.ALGORITHM
  ADD CONSTRAINT SQL060921094227690 PRIMARY KEY (ALGORITHM_ID);

CREATE TABLE TBASE2.ANALYSIS
  (ANALYSIS_ID BIGINT NOT NULL,
   VERSION INTEGER,
   NOTES VARCHAR(2000),
   NAME VARCHAR(255),
   STUDY_ID BIGINT,
   ANALYSIS_ORDER INTEGER);

ALTER TABLE TBASE2.ANALYSIS
  ADD CONSTRAINT SQL060921094227710 PRIMARY KEY (ANALYSIS_ID);

CREATE TABLE TBASE2.ANALYSISSTEP
  (ANALYSISSTEP_ID BIGINT NOT NULL,
   VERSION INTEGER,
   PUBLISHED SMALLINT,
   NOTES VARCHAR(2000),
   COMMANDS VARCHAR(2000),
   NAME VARCHAR(255),
   ANALYSIS_ID BIGINT,
   ALGORITHM_ID BIGINT,
   SOFTWARE_ID BIGINT,
   STEP_ORDER INTEGER,
   TB_ANALYSISID VARCHAR(34));

ALTER TABLE TBASE2.ANALYSISSTEP
  ADD CONSTRAINT SQL060921094227780 PRIMARY KEY (ANALYSISSTEP_ID);

CREATE TABLE TBASE2.ANALYZEDDATA
  (TYPE CHARACTER(1) NOT NULL,
   ANALYZEDDATA_ID BIGINT NOT NULL,
   VERSION INTEGER,
   NOTES VARCHAR(2000),
   INPUT SMALLINT,
   TREELENGTH INTEGER,
   ANALYSISSTEP_ID BIGINT NOT NULL,
   MATRIX_ID BIGINT,
   PHYLOTREE_ID BIGINT);

ALTER TABLE TBASE2.ANALYZEDDATA
  ADD CONSTRAINT SQL060921094227800 PRIMARY KEY (ANALYZEDDATA_ID);

CREATE TABLE TBASE2.ANCESTRALSTATE
  (TYPE CHARACTER(1) NOT NULL,
   ANCESTRALSTATE_ID BIGINT NOT NULL,
   VERSION INTEGER,
   TITLE VARCHAR(255),
   ANCVALUE VARCHAR(255),
   DISCRETECHARSTATE_ID BIGINT,
   ANCSTATESET_ID BIGINT);

ALTER TABLE TBASE2.ANCESTRALSTATE
  ADD CONSTRAINT SQL060921094227820 PRIMARY KEY (ANCESTRALSTATE_ID);

CREATE TABLE TBASE2.ANCSTATESET
  (ANCSTATESET_ID BIGINT NOT NULL,
   VERSION INTEGER,
   TITLE VARCHAR(255),
   MATRIX_ID BIGINT);

ALTER TABLE TBASE2.ANCSTATESET
  ADD CONSTRAINT SQL060921094227840 PRIMARY KEY (ANCSTATESET_ID);

CREATE TABLE TBASE2.CHARGROUP
  (CHARGROUP_ID BIGINT NOT NULL,
   VERSION INTEGER,
   TITLE VARCHAR(255),
   CHARPARTITION_ID BIGINT);

ALTER TABLE TBASE2.CHARGROUP
  ADD CONSTRAINT SQL060921094227860 PRIMARY KEY (CHARGROUP_ID);

CREATE TABLE TBASE2.CHARGROUP_PHYLOCHAR
  (CHARGROUP_ID BIGINT NOT NULL,
   PHYLOCHAR_ID BIGINT NOT NULL);

ALTER TABLE TBASE2.CHARGROUP_PHYLOCHAR
  ADD CONSTRAINT SQL060921094227880 PRIMARY KEY (CHARGROUP_ID, PHYLOCHAR_ID);

CREATE TABLE TBASE2.CHARPARTITION
  (CHARPARTITION_ID BIGINT NOT NULL,
   VERSION INTEGER,
   TITLE VARCHAR(255));

ALTER TABLE TBASE2.CHARPARTITION
  ADD CONSTRAINT SQL060921094227900 PRIMARY KEY (CHARPARTITION_ID);

CREATE TABLE TBASE2.CHARSET
  (TYPE CHARACTER(1) NOT NULL,
   CHARSET_ID BIGINT NOT NULL,
   VERSION INTEGER,
   TITLE VARCHAR(255),
   MATRIX_ID BIGINT);

ALTER TABLE TBASE2.CHARSET
  ADD CONSTRAINT SQL060921094227920 PRIMARY KEY (CHARSET_ID);

CREATE TABLE TBASE2.CHARWEIGHT
  (TYPE CHARACTER(1) NOT NULL,
   CHARWEIGHT_ID BIGINT NOT NULL,
   VERSION INTEGER,
   WEIGHT INTEGER,
   REALWEIGHT DOUBLE,
   PHYLOCHAR_ID BIGINT,
   CHARWEIGHTSET_ID BIGINT);

ALTER TABLE TBASE2.CHARWEIGHT
  ADD CONSTRAINT SQL060921094227940 PRIMARY KEY (CHARWEIGHT_ID);

CREATE TABLE TBASE2.CHARWEIGHTSET
  (CHARWEIGHTSET_ID BIGINT NOT NULL,
   VERSION INTEGER,
   TITLE VARCHAR(255),
   MATRIX_ID BIGINT);

ALTER TABLE TBASE2.CHARWEIGHTSET
  ADD CONSTRAINT SQL060921094227960 PRIMARY KEY (CHARWEIGHTSET_ID);

CREATE TABLE TBASE2.CITATION
  (TYPE CHARACTER(1) NOT NULL,
   CITATION_ID BIGINT NOT NULL,
   VERSION INTEGER,
   PUBLISHED SMALLINT,
   PAGES VARCHAR(255),
   KEYWORDS VARCHAR(255),
   PUBLISHYEAR INTEGER,
   PMID VARCHAR(255),
   DOI VARCHAR(255),
   ABSTRACT VARCHAR(5000),
   URL VARCHAR(255),
   TITLE VARCHAR(255),
   ISSUE VARCHAR(255),
   VOLUME VARCHAR(255),
   JOURNAL VARCHAR(255),
   ISBN VARCHAR(255),
   CITY VARCHAR(255),
   PUBLISHER VARCHAR(255),
   BOOKTITLE VARCHAR(255),
   TB_STUDYID VARCHAR(30));

ALTER TABLE TBASE2.CITATION
  ADD CONSTRAINT SQL060921094228030 PRIMARY KEY (CITATION_ID);

CREATE TABLE TBASE2.CITATION_AUTHOR
  (CITATION_ID BIGINT NOT NULL,
   AUTHORS_PERSON_ID BIGINT NOT NULL,
   AUTHOR_ORDER INTEGER NOT NULL);

ALTER TABLE TBASE2.CITATION_AUTHOR
  ADD CONSTRAINT SQL060921094228050 PRIMARY KEY (CITATION_ID, AUTHOR_ORDER);

CREATE TABLE TBASE2.CITATION_EDITOR
  (CITATION_ID BIGINT NOT NULL,
   EDITORS_PERSON_ID BIGINT NOT NULL,
   EDITOR_ORDER INTEGER NOT NULL);

ALTER TABLE TBASE2.CITATION_EDITOR
  ADD CONSTRAINT SQL060921094228070 PRIMARY KEY (CITATION_ID, EDITOR_ORDER);

CREATE TABLE TBASE2.CODERECORD_COLRANGE
  (GENETICCODERECORD_ID BIGINT NOT NULL,
   COLUMNRANGE_ID BIGINT NOT NULL);

ALTER TABLE TBASE2.CODERECORD_COLRANGE
  ADD CONSTRAINT SQL060921094228160 PRIMARY KEY (GENETICCODERECORD_ID, COLUMNRANGE_ID);

ALTER TABLE TBASE2.CODERECORD_COLRANGE
  ADD CONSTRAINT SQL060921094228170 UNIQUE();

ALTER TABLE TBASE2.CODERECORD_COLRANGE
  ADD CONSTRAINT SQL060512164422350 UNIQUE(COLUMNRANGE_ID);

CREATE TABLE TBASE2.CODONCHAR1_COLRANGE
  (CODONPOSITIONSET_ID BIGINT NOT NULL,
   COLUMNRANGE_ID BIGINT NOT NULL);

ALTER TABLE TBASE2.CODONCHAR1_COLRANGE
  ADD CONSTRAINT SQL060921094228180 PRIMARY KEY (CODONPOSITIONSET_ID, COLUMNRANGE_ID);

ALTER TABLE TBASE2.CODONCHAR1_COLRANGE
  ADD CONSTRAINT SQL060921094228190 UNIQUE();

ALTER TABLE TBASE2.CODONCHAR1_COLRANGE
  ADD CONSTRAINT SQL060512164422371 UNIQUE(COLUMNRANGE_ID);

CREATE TABLE TBASE2.CODONCHAR2_COLRANGE
  (CODONPOSITIONSET_ID BIGINT NOT NULL,
   COLUMNRANGE_ID BIGINT NOT NULL);

ALTER TABLE TBASE2.CODONCHAR2_COLRANGE
  ADD CONSTRAINT SQL060921094228210 PRIMARY KEY (CODONPOSITIONSET_ID, COLUMNRANGE_ID);

ALTER TABLE TBASE2.CODONCHAR2_COLRANGE
  ADD CONSTRAINT SQL060921094228211 UNIQUE();

ALTER TABLE TBASE2.CODONCHAR2_COLRANGE
  ADD CONSTRAINT SQL060512164422400 UNIQUE(COLUMNRANGE_ID);

CREATE TABLE TBASE2.CODONCHAR3_COLRANGE
  (CODONPOSITIONSET_ID BIGINT NOT NULL,
   COLUMNRANGE_ID BIGINT NOT NULL);

ALTER TABLE TBASE2.CODONCHAR3_COLRANGE
  ADD CONSTRAINT SQL060921094228230 PRIMARY KEY (CODONPOSITIONSET_ID, COLUMNRANGE_ID);

ALTER TABLE TBASE2.CODONCHAR3_COLRANGE
  ADD CONSTRAINT SQL060921094228231 UNIQUE();

ALTER TABLE TBASE2.CODONCHAR3_COLRANGE
  ADD CONSTRAINT SQL060512164422421 UNIQUE(COLUMNRANGE_ID);

CREATE TABLE TBASE2.CODONNONCODING_COLRANGE
  (CODONPOSITIONSET_ID BIGINT NOT NULL,
   COLUMNRANGE_ID BIGINT NOT NULL);

ALTER TABLE TBASE2.CODONNONCODING_COLRANGE
  ADD CONSTRAINT SQL060921094228250 PRIMARY KEY (CODONPOSITIONSET_ID, COLUMNRANGE_ID);

ALTER TABLE TBASE2.CODONNONCODING_COLRANGE
  ADD CONSTRAINT SQL060921094228260 UNIQUE();

ALTER TABLE TBASE2.CODONNONCODING_COLRANGE
  ADD CONSTRAINT SQL060512164422441 UNIQUE(COLUMNRANGE_ID);

CREATE TABLE TBASE2.CODONPOSITIONSET
  (CODONPOSITIONSET_ID BIGINT NOT NULL,
   VERSION INTEGER,
   TITLE VARCHAR(255),
   MATRIX_ID BIGINT);

ALTER TABLE TBASE2.CODONPOSITIONSET
  ADD CONSTRAINT SQL060921094228280 PRIMARY KEY (CODONPOSITIONSET_ID);

CREATE TABLE TBASE2.COLUMNRANGE
  (COLUMNRANGE_ID BIGINT NOT NULL,
   VERSION INTEGER,
   REPEATINTERVAL INTEGER,
   ENDCOLINDEX INTEGER,
   STARTCOLINDEX INTEGER);

ALTER TABLE TBASE2.COLUMNRANGE
  ADD CONSTRAINT SQL060921094228090 PRIMARY KEY (COLUMNRANGE_ID);

CREATE TABLE TBASE2.COMPOUND_ELEMENT
  (COMPOUND_ID BIGINT NOT NULL,
   ELEMENT_ID BIGINT NOT NULL);

ALTER TABLE TBASE2.COMPOUND_ELEMENT
  ADD CONSTRAINT SQL060921094228110 PRIMARY KEY (COMPOUND_ID, ELEMENT_ID);

ALTER TABLE TBASE2.COMPOUND_ELEMENT
  ADD CONSTRAINT SQL060921094228120 UNIQUE();

ALTER TABLE TBASE2.COMPOUND_ELEMENT
  ADD CONSTRAINT SQL060512164422261 UNIQUE(ELEMENT_ID);

CREATE TABLE TBASE2.CONTANCSTATE_VALUE
  (ANCSTATE_ID BIGINT NOT NULL,
   ELT VARCHAR(255));

CREATE TABLE TBASE2.CSTREENODE
  (CSTREENODE_ID BIGINT NOT NULL,
   VERSION INTEGER,
   DISCRETECHARSTATE_ID BIGINT,
   CSTREE_ID BIGINT NOT NULL,
   PARENTNODE_ID BIGINT);

ALTER TABLE TBASE2.CSTREENODE
  ADD CONSTRAINT SQL060921094228140 PRIMARY KEY (CSTREENODE_ID);

CREATE TABLE TBASE2.DISCRETECHARSTATE
  (DISCRETECHARSTATE_ID BIGINT NOT NULL,
   VERSION INTEGER,
   DESCRIPTION VARCHAR(255),
   PHYLOCHAR_ID BIGINT NOT NULL,
   STATESET_ID BIGINT,
   ANCESTRALSTATE_ID BIGINT);

ALTER TABLE TBASE2.DISCRETECHARSTATE
  ADD CONSTRAINT SQL060921094228300 PRIMARY KEY (DISCRETECHARSTATE_ID);

CREATE TABLE TBASE2.DISTANCEMATRIXELEMENT
  (DISTANCEMATRIXELEMENT_ID BIGINT NOT NULL,
   VERSION INTEGER,
   DISTANCE DOUBLE,
   COLUMNLABEL_ID BIGINT,
   ROWLABEL_ID BIGINT NOT NULL,
   MATRIX_ID BIGINT NOT NULL);

ALTER TABLE TBASE2.DISTANCEMATRIXELEMENT
  ADD CONSTRAINT SQL060921094228320 PRIMARY KEY (DISTANCEMATRIXELEMENT_ID);

CREATE TABLE TBASE2.GAPMODE
  (GAPMODE_ID BIGINT NOT NULL,
   VERSION INTEGER,
   DESCRIPTION VARCHAR(255));

ALTER TABLE TBASE2.GAPMODE
  ADD CONSTRAINT SQL060921094228330 PRIMARY KEY (GAPMODE_ID);

CREATE TABLE TBASE2.GENETICCODE
  (GENETICCODE_ID BIGINT NOT NULL,
   VERSION INTEGER,
   CODEDESCRIPTION VARCHAR(1000),
   NUCORDER VARCHAR(255),
   CODEORDER VARCHAR(255),
   PREDEFINED SMALLINT,
   TITLE VARCHAR(255),
   EXTENSIONS VARCHAR(255));

ALTER TABLE TBASE2.GENETICCODE
  ADD CONSTRAINT SQL060921094228390 PRIMARY KEY (GENETICCODE_ID);

CREATE TABLE TBASE2.GENETICCODERECORD
  (GENETICCODERECORD_ID BIGINT NOT NULL,
   VERSION INTEGER,
   GENETICCODE_ID BIGINT,
   GENETICCODESET_ID BIGINT NOT NULL);

ALTER TABLE TBASE2.GENETICCODERECORD
  ADD CONSTRAINT SQL060921094228410 PRIMARY KEY (GENETICCODERECORD_ID);

CREATE TABLE TBASE2.GENETICCODESET
  (GENETICCODESET_ID BIGINT NOT NULL,
   VERSION INTEGER,
   TITLE VARCHAR(255),
   FORMAT VARCHAR(255),
   MATRIX_ID BIGINT);

ALTER TABLE TBASE2.GENETICCODESET
  ADD CONSTRAINT SQL060921094228350 PRIMARY KEY (GENETICCODESET_ID);

CREATE TABLE TBASE2.GEOSPOT
  (GEOSPOT_ID BIGINT NOT NULL,
   VERSION INTEGER,
   NOTES VARCHAR(2000),
   ELEVATION DOUBLE,
   LONGITUDE DOUBLE,
   LATITUDE DOUBLE,
   NAME VARCHAR(255));

ALTER TABLE TBASE2.GEOSPOT
  ADD CONSTRAINT SQL060921094228370 PRIMARY KEY (GEOSPOT_ID);

CREATE TABLE TBASE2.ITEMDEFINITION
  (ITEMDEFINITION_ID BIGINT NOT NULL,
   VERSION INTEGER,
   DESCRIPTION VARCHAR(255));

ALTER TABLE TBASE2.ITEMDEFINITION
  ADD CONSTRAINT SQL060921094228430 PRIMARY KEY (ITEMDEFINITION_ID);

CREATE TABLE TBASE2.ITEMVALUE
  (ITEMVALUE_ID BIGINT NOT NULL,
   VERSION INTEGER,
   VALUE VARCHAR(255),
   ITEMDEFINITION_ID BIGINT NOT NULL,
   ELEMENT_ID BIGINT NOT NULL);

ALTER TABLE TBASE2.ITEMVALUE
  ADD CONSTRAINT SQL060921094228450 PRIMARY KEY (ITEMVALUE_ID);

CREATE TABLE TBASE2.LEFTCHANGESET_CHARSTATE
  (STATECHANGESET_ID BIGINT NOT NULL,
   DISCRETECHARSTATE_ID BIGINT NOT NULL);

ALTER TABLE TBASE2.LEFTCHANGESET_CHARSTATE
  ADD CONSTRAINT SQL060921094228470 PRIMARY KEY (STATECHANGESET_ID, DISCRETECHARSTATE_ID);

CREATE TABLE TBASE2.MATRIX
  (MATRIXTYPE CHARACTER(1) NOT NULL,
   MATRIX_ID BIGINT NOT NULL,
   VERSION INTEGER,
   PUBLISHED SMALLINT,
   MISSINGSYMBOL VARCHAR(255),
   GAPSYMBOL VARCHAR(255),
   TITLE VARCHAR(255),
   DESCRIPTION VARCHAR(2000),
   ALIGNED SMALLINT,
   TRIANGLE VARCHAR(255),
   DIAGONAL SMALLINT,
   CASESENSITIVE SMALLINT,
   MATRIXDATATYPE_ID BIGINT,
   CODONPOSITIONSET_ID BIGINT,
   CHARWEIGHTSET_ID BIGINT,
   CHARSET_ID BIGINT,
   TYPESET_ID BIGINT,
   ANCSTATESET_ID BIGINT,
   TB_MATRIXID VARCHAR(30));

ALTER TABLE TBASE2.MATRIX
  ADD CONSTRAINT SQL060921094228490 PRIMARY KEY (MATRIX_ID);

CREATE TABLE TBASE2.MATRIXCOLUMN
  (MATRIXCOLUMN_ID BIGINT NOT NULL,
   VERSION INTEGER,
   PHYLOCHAR_ID BIGINT,
   STATEFORMAT_ID BIGINT,
   MATRIX_ID BIGINT,
   COLUMN_ORDER INTEGER);

ALTER TABLE TBASE2.MATRIXCOLUMN
  ADD CONSTRAINT SQL060921094228510 PRIMARY KEY (MATRIXCOLUMN_ID);

CREATE TABLE TBASE2.MATRIXCOLUMN_ITEMDEFINITION
  (MATRIXCOLUMN_ID BIGINT NOT NULL,
   ITEMDEFINITION_ID BIGINT NOT NULL);

ALTER TABLE TBASE2.MATRIXCOLUMN_ITEMDEFINITION
  ADD CONSTRAINT SQL060921094228520 PRIMARY KEY (MATRIXCOLUMN_ID, ITEMDEFINITION_ID);

CREATE TABLE TBASE2.MATRIXDATATYPE
  (MATRIXDATATYPE_ID BIGINT NOT NULL,
   VERSION INTEGER,
   DESCRIPTION VARCHAR(255),
   PHYLOCHAR_ID BIGINT);

ALTER TABLE TBASE2.MATRIXDATATYPE
  ADD CONSTRAINT SQL060921094228540 PRIMARY KEY (MATRIXDATATYPE_ID);

CREATE TABLE TBASE2.MATRIXELEMENT
  (TYPE CHARACTER(1) NOT NULL,
   MATRIXELEMENT_ID BIGINT NOT NULL,
   VERSION INTEGER,
   ANDLOGIC SMALLINT,
   VALUE VARCHAR(255),
   MATRIXCOLUMN_ID BIGINT,
   MATRIXROW_ID BIGINT,
   DISCRETECHARSTATE_ID BIGINT,
   ELEMENT_ORDER INTEGER);

ALTER TABLE TBASE2.MATRIXELEMENT
  ADD CONSTRAINT SQL060921094228560 PRIMARY KEY (MATRIXELEMENT_ID);

CREATE TABLE TBASE2.MATRIXROW
  (MATRIXROW_ID BIGINT NOT NULL,
   VERSION INTEGER,
   TAXONLABEL_ID BIGINT NOT NULL,
   MATRIX_ID BIGINT);

ALTER TABLE TBASE2.MATRIXROW
  ADD CONSTRAINT SQL060921094228580 PRIMARY KEY (MATRIXROW_ID);

CREATE TABLE TBASE2.NODEATTRIBUTE
  (NODEATTRIBUTE_ID BIGINT NOT NULL,
   VERSION INTEGER);

ALTER TABLE TBASE2.NODEATTRIBUTE
  ADD CONSTRAINT SQL060921094228600 PRIMARY KEY (NODEATTRIBUTE_ID);

CREATE TABLE TBASE2.PERSON
  (PERSON_ID BIGINT NOT NULL,
   VERSION INTEGER,
   LASTNAME VARCHAR(255) NOT NULL,
   FIRSTNAME VARCHAR(255),
   MNAME VARCHAR(255),
   EMAIL VARCHAR(255),
   AUTHORID VARCHAR(50));

ALTER TABLE TBASE2.PERSON
  ADD CONSTRAINT SQL060921094228620 PRIMARY KEY (PERSON_ID);

CREATE TABLE TBASE2.PHYLOCHAR
  (TYPE CHARACTER(1) NOT NULL,
   PHYLOCHAR_ID BIGINT NOT NULL,
   VERSION INTEGER,
   DESCRIPTION VARCHAR(255),
   LOWERLIMIT DOUBLE,
   UPPERLIMIT DOUBLE,
   CHARSET_ID BIGINT);

ALTER TABLE TBASE2.PHYLOCHAR
  ADD CONSTRAINT SQL060921094228640 PRIMARY KEY (PHYLOCHAR_ID);

CREATE TABLE TBASE2.PHYLOTREE
  (PHYLOTREE_ID BIGINT NOT NULL,
   VERSION INTEGER,
   PUBLISHED SMALLINT,
   NEWICKSTRING CLOB(4194304),
   BIGTREE SMALLINT,
   ROOTEDTREE SMALLINT,
   TITLE VARCHAR(255),
   TREEQUALITY_ID BIGINT,
   TREETYPE_ID BIGINT,
   ROOTNODE_ID BIGINT,
   TREEATTRIBUTE_ID BIGINT);

ALTER TABLE TBASE2.PHYLOTREE
  ADD CONSTRAINT SQL060921094228660 PRIMARY KEY (PHYLOTREE_ID);

CREATE TABLE TBASE2.PHYLOTREENODE
  (PHYLOTREENODE_ID BIGINT NOT NULL,
   VERSION INTEGER,
   NODEDEPTH INTEGER,
   BRANCHLENGTH DOUBLE,
   NAME VARCHAR(255),
   TAXONLABEL_ID BIGINT,
   PHYLOTREE_ID BIGINT NOT NULL,
   SIBLING_ID BIGINT,
   CHILD_ID BIGINT,
   NODEATTRIBUTE_ID BIGINT);

ALTER TABLE TBASE2.PHYLOTREENODE
  ADD CONSTRAINT SQL060921094228680 PRIMARY KEY (PHYLOTREENODE_ID);

CREATE TABLE TBASE2.POLYTCOUNT
  (POLYTCOUNT_ID BIGINT NOT NULL,
   VERSION INTEGER,
   DESCRIPTION VARCHAR(255));

ALTER TABLE TBASE2.POLYTCOUNT
  ADD CONSTRAINT SQL060921094228700 PRIMARY KEY (POLYTCOUNT_ID);

CREATE TABLE TBASE2.RIGHTCHANGESET_CHARSTATE
  (STATECHANGESET_ID BIGINT NOT NULL,
   DISCRETECHARSTATE_ID BIGINT NOT NULL);

ALTER TABLE TBASE2.RIGHTCHANGESET_CHARSTATE
  ADD CONSTRAINT SQL060921094228720 PRIMARY KEY (STATECHANGESET_ID, DISCRETECHARSTATE_ID);

CREATE TABLE TBASE2.ROWSEGMENT
  (ROWSEGMENT_ID BIGINT NOT NULL,
   VERSION INTEGER,
   STARTINDEX INTEGER,
   TITLE VARCHAR(255),
   ENDINDEX INTEGER,
   MATRIXROW_ID BIGINT NOT NULL,
   SPECIMENLABEL_ID BIGINT);

ALTER TABLE TBASE2.ROWSEGMENT
  ADD CONSTRAINT SQL060921094228740 PRIMARY KEY (ROWSEGMENT_ID);

CREATE TABLE TBASE2.SOFTWARE
  (SOFTWARE_ID BIGINT NOT NULL,
   VERSION INTEGER,
   SOFTWAREVERSION VARCHAR(255),
   NAME VARCHAR(255),
   DESCRIPTION VARCHAR(2000));

ALTER TABLE TBASE2.SOFTWARE
  ADD CONSTRAINT SQL060921094228760 PRIMARY KEY (SOFTWARE_ID);

CREATE TABLE TBASE2.SPECIMEN
  (SPECIMEN_ID BIGINT NOT NULL,
   VERSION INTEGER,
   TISSUE VARCHAR(255),
   MUSEUMNUMBER VARCHAR(255),
   TAXON_ID BIGINT,
   GEOSPOT_ID BIGINT);

ALTER TABLE TBASE2.SPECIMEN
  ADD CONSTRAINT SQL060921094228780 PRIMARY KEY (SPECIMEN_ID);

CREATE TABLE TBASE2.SPECIMENLABEL
  (SPECIMENLABEL_ID BIGINT NOT NULL,
   VERSION INTEGER,
   GENBANKID VARCHAR(255),
   SPECIMEN_ID BIGINT);

ALTER TABLE TBASE2.SPECIMENLABEL
  ADD CONSTRAINT SQL060921094228800 PRIMARY KEY (SPECIMENLABEL_ID);

CREATE TABLE TBASE2.STATECHANGESET
  (STATECHANGESET_ID BIGINT NOT NULL,
   VERSION INTEGER,
   REVERSIBLE SMALLINT,
   TITLE VARCHAR(255));

ALTER TABLE TBASE2.STATECHANGESET
  ADD CONSTRAINT SQL060921094228820 PRIMARY KEY (STATECHANGESET_ID);

CREATE TABLE TBASE2.STATEFORMAT
  (STATEFORMAT_ID BIGINT NOT NULL,
   VERSION INTEGER,
   DESCRIPTION VARCHAR(255));

ALTER TABLE TBASE2.STATEFORMAT
  ADD CONSTRAINT SQL060921094228840 PRIMARY KEY (STATEFORMAT_ID);

CREATE TABLE TBASE2.STATEMODIFIER
  (STATEMODIFIER_ID BIGINT NOT NULL,
   VERSION INTEGER,
   FREQUENCY DOUBLE,
   COUNT INTEGER,
   DISCRETECHARSTATE_ID BIGINT,
   ELEMENT_ID BIGINT NOT NULL,
   STATEFORMAT_ID BIGINT NOT NULL);

ALTER TABLE TBASE2.STATEMODIFIER
  ADD CONSTRAINT SQL060921094228860 PRIMARY KEY (STATEMODIFIER_ID);

CREATE TABLE TBASE2.STATESET
  (STATESET_ID BIGINT NOT NULL,
   VERSION INTEGER,
   TITLE VARCHAR(255),
   MATRIX_ID BIGINT);

ALTER TABLE TBASE2.STATESET
  ADD CONSTRAINT SQL060921094228880 PRIMARY KEY (STATESET_ID);

CREATE TABLE TBASE2.STEPMATRIXELEMENT
  (DISCRETECHARSTATE_ID BIGINT NOT NULL,
   VERSION INTEGER,
   TRANSCOST DOUBLE,
   STEPMATRIX_ID BIGINT NOT NULL,
   STATE2_ID BIGINT,
   STATE1_ID BIGINT);

ALTER TABLE TBASE2.STEPMATRIXELEMENT
  ADD CONSTRAINT SQL060921094228900 PRIMARY KEY (DISCRETECHARSTATE_ID);

CREATE TABLE TBASE2.STUDY
  (STUDY_ID BIGINT NOT NULL,
   VERSION INTEGER,
   NOTES VARCHAR(2000),
   ACESSIONNUMBER VARCHAR(255),
   RELEASEDATE DATE,
   NAME VARCHAR(255),
   CITATION_ID BIGINT,
   STUDYSTATUS_ID BIGINT,
   TB_STUDYID VARCHAR(30));

ALTER TABLE TBASE2.STUDY
  ADD CONSTRAINT SQL060921094228920 PRIMARY KEY (STUDY_ID);

CREATE TABLE TBASE2.STUDYSTATUS
  (STUDYSTATUS_ID BIGINT NOT NULL,
   VERSION INTEGER,
   DESCRIPTION VARCHAR(255));

ALTER TABLE TBASE2.STUDYSTATUS
  ADD CONSTRAINT SQL060921094228940 PRIMARY KEY (STUDYSTATUS_ID);

CREATE TABLE TBASE2.SUB_MATRIX
  (SUBMISSION_ID BIGINT NOT NULL,
   MATRIX_ID BIGINT NOT NULL,
   MATRIX_ORDER INTEGER NOT NULL);

ALTER TABLE TBASE2.SUB_MATRIX
  ADD CONSTRAINT SQL060921094228980 PRIMARY KEY (SUBMISSION_ID, MATRIX_ORDER);

CREATE TABLE TBASE2.SUB_PHLYOTREE
  (SUBMISSION_ID BIGINT NOT NULL,
   PHYLOTREE_ID BIGINT NOT NULL,
   TREE_ORDER INTEGER NOT NULL);

ALTER TABLE TBASE2.SUB_PHLYOTREE
  ADD CONSTRAINT SQL060921094229000 PRIMARY KEY (SUBMISSION_ID, TREE_ORDER);

ALTER TABLE TBASE2.SUB_PHLYOTREE
  ADD CONSTRAINT SQL060921094229010 UNIQUE();

ALTER TABLE TBASE2.SUB_PHLYOTREE
  ADD CONSTRAINT SQL060512164423180 UNIQUE(PHYLOTREE_ID);

CREATE TABLE TBASE2.SUB_TAXONLABEL
  (SUBMISSION_ID BIGINT NOT NULL,
   TAXONLABEL_ID BIGINT NOT NULL,
   TAXONLABEL_ORDER INTEGER NOT NULL);

ALTER TABLE TBASE2.SUB_TAXONLABEL
  ADD CONSTRAINT SQL060921094229030 PRIMARY KEY (SUBMISSION_ID, TAXONLABEL_ORDER);

ALTER TABLE TBASE2.SUB_TAXONLABEL
  ADD CONSTRAINT SQL060921094229031 UNIQUE();

CREATE TABLE TBASE2.SUBMISSION
  (SUBMISSION_ID BIGINT NOT NULL,
   VERSION INTEGER,
   SUBMISSIONNUMBER VARCHAR(255),
   CREATEDATE DATE,
   USER_ID BIGINT,
   STUDY_ID BIGINT NOT NULL);

ALTER TABLE TBASE2.SUBMISSION
  ADD CONSTRAINT SQL060921094228960 PRIMARY KEY (SUBMISSION_ID);

ALTER TABLE TBASE2.SUBMISSION
  ADD CONSTRAINT SQL060921094228961 UNIQUE();

CREATE TABLE TBASE2.TAXON
  (TAXON_ID BIGINT NOT NULL,
   VERSION INTEGER,
   NAME VARCHAR(255),
   DESCRIPTION VARCHAR(2000));

ALTER TABLE TBASE2.TAXON
  ADD CONSTRAINT SQL060921094229050 PRIMARY KEY (TAXON_ID);

CREATE TABLE TBASE2.TAXONAUTHORITY
  (TAXONAUTHORITY_ID BIGINT NOT NULL,
   VERSION INTEGER,
   CONNECTIONSTR VARCHAR(1000),
   NAME VARCHAR(255),
   DESCRIPTION VARCHAR(2000));

ALTER TABLE TBASE2.TAXONAUTHORITY
  ADD CONSTRAINT SQL060921094229070 PRIMARY KEY (TAXONAUTHORITY_ID);

CREATE TABLE TBASE2.TAXONLABEL
  (TAXONLABEL_ID BIGINT NOT NULL,
   VERSION INTEGER,
   TAXONLABEL VARCHAR(255),
   STUDY_ID BIGINT,
   TAXON_ID BIGINT);

ALTER TABLE TBASE2.TAXONLABEL
  ADD CONSTRAINT SQL060921094229090 PRIMARY KEY (TAXONLABEL_ID);

CREATE TABLE TBASE2.TAXONLABELGROUP
  (TAXONLABELGROUP_ID BIGINT NOT NULL,
   VERSION INTEGER,
   TITLE VARCHAR(255),
   TAXONLABELPARTITION_ID BIGINT);

ALTER TABLE TBASE2.TAXONLABELGROUP
  ADD CONSTRAINT SQL060921094229110 PRIMARY KEY (TAXONLABELGROUP_ID);

CREATE TABLE TBASE2.TAXONLABELPARTITION
  (TAXONLABELPARTITION_ID BIGINT NOT NULL,
   VERSION INTEGER,
   TITLE VARCHAR(255));

ALTER TABLE TBASE2.TAXONLABELPARTITION
  ADD CONSTRAINT SQL060921094229130 PRIMARY KEY (TAXONLABELPARTITION_ID);

CREATE TABLE TBASE2.TAXONLABELROUP_TAXONLABEL
  (TAXONLABELGROUP_ID BIGINT NOT NULL,
   TAXONLABEL_ID BIGINT NOT NULL);

ALTER TABLE TBASE2.TAXONLABELROUP_TAXONLABEL
  ADD CONSTRAINT SQL060921094229150 PRIMARY KEY (TAXONLABELGROUP_ID, TAXONLABEL_ID);

CREATE TABLE TBASE2.TAXONLABELSET
  (TAXONLABELSET_ID BIGINT NOT NULL,
   VERSION INTEGER,
   TITLE VARCHAR(255),
   STUDY_ID BIGINT);

ALTER TABLE TBASE2.TAXONLABELSET
  ADD CONSTRAINT SQL060921094229410 PRIMARY KEY (TAXONLABELSET_ID);

CREATE TABLE TBASE2.TAXONLABELSET_TAXONLABEL
  (TAXONLABELSET_ID BIGINT NOT NULL,
   TAXONLABEL_ID BIGINT NOT NULL,
   TAXONLABEL_ORDER INTEGER NOT NULL);

ALTER TABLE TBASE2.TAXONLABELSET_TAXONLABEL
  ADD CONSTRAINT SQL060921094229430 PRIMARY KEY (TAXONLABELSET_ID, TAXONLABEL_ORDER);

CREATE TABLE TBASE2.TAXONLINK
  (LINKTYPE CHARACTER(1) NOT NULL,
   TAXONLINK_ID BIGINT NOT NULL,
   VERSION INTEGER,
   FOREIGNTAXONID VARCHAR(255),
   TAXONAUTHORITY_ID BIGINT NOT NULL,
   TAXON_ID BIGINT NOT NULL);

ALTER TABLE TBASE2.TAXONLINK
  ADD CONSTRAINT SQL060921094229170 PRIMARY KEY (TAXONLINK_ID);

CREATE TABLE TBASE2.TAXONSET
  (TAXONSET_ID BIGINT NOT NULL,
   VERSION INTEGER,
   TITLE VARCHAR(255));

ALTER TABLE TBASE2.TAXONSET
  ADD CONSTRAINT SQL060921094229190 PRIMARY KEY (TAXONSET_ID);

CREATE TABLE TBASE2.TAXONSET_TAXON
  (TAXONSET_ID BIGINT NOT NULL,
   TAXON_ID BIGINT NOT NULL,
   TAXON_ORDER INTEGER NOT NULL);

ALTER TABLE TBASE2.TAXONSET_TAXON
  ADD CONSTRAINT SQL060921094229200 PRIMARY KEY (TAXONSET_ID, TAXON_ORDER);

CREATE TABLE TBASE2.TREEATTRIBUTE
  (TREEATTRIBUTE_ID BIGINT NOT NULL,
   VERSION INTEGER);

ALTER TABLE TBASE2.TREEATTRIBUTE
  ADD CONSTRAINT SQL060921094229220 PRIMARY KEY (TREEATTRIBUTE_ID);

CREATE TABLE TBASE2.TREEGROUP
  (TREEGROUP_ID BIGINT NOT NULL,
   VERSION INTEGER,
   TITLE VARCHAR(255),
   TREEPARTITION_ID BIGINT);

ALTER TABLE TBASE2.TREEGROUP
  ADD CONSTRAINT SQL060921094229240 PRIMARY KEY (TREEGROUP_ID);

CREATE TABLE TBASE2.TREEGROUP_PHYLOTREE
  (TREEGROUP_ID BIGINT NOT NULL,
   PHYLOTREE_ID BIGINT NOT NULL);

ALTER TABLE TBASE2.TREEGROUP_PHYLOTREE
  ADD CONSTRAINT SQL060921094229260 PRIMARY KEY (TREEGROUP_ID, PHYLOTREE_ID);

CREATE TABLE TBASE2.TREENODEEDGE
  (TREENODEEDGE_ID BIGINT NOT NULL,
   VERSION INTEGER,
   CHILDNODE_ID BIGINT NOT NULL,
   PARENTNODE_ID BIGINT NOT NULL);

ALTER TABLE TBASE2.TREENODEEDGE
  ADD CONSTRAINT SQL060921094229280 PRIMARY KEY (TREENODEEDGE_ID);

CREATE TABLE TBASE2.TREEPARTITION
  (TREEPARTITION_ID BIGINT NOT NULL,
   VERSION INTEGER,
   TITLE VARCHAR(255));

ALTER TABLE TBASE2.TREEPARTITION
  ADD CONSTRAINT SQL060921094229300 PRIMARY KEY (TREEPARTITION_ID);

CREATE TABLE TBASE2.TREEQUALITY
  (TREEQUALITY_ID BIGINT NOT NULL,
   VERSION INTEGER,
   DESCRIPTION VARCHAR(255));

ALTER TABLE TBASE2.TREEQUALITY
  ADD CONSTRAINT SQL060921094229320 PRIMARY KEY (TREEQUALITY_ID);

CREATE TABLE TBASE2.TREESET
  (TREESET_ID BIGINT NOT NULL,
   VERSION INTEGER,
   TITLE VARCHAR(255));

ALTER TABLE TBASE2.TREESET
  ADD CONSTRAINT SQL060921094229340 PRIMARY KEY (TREESET_ID);

CREATE TABLE TBASE2.TREESET_PHYLOTREE
  (TREESET_ID BIGINT NOT NULL,
   PHYLOTREE_ID BIGINT NOT NULL,
   TREE_ORDER INTEGER NOT NULL);

ALTER TABLE TBASE2.TREESET_PHYLOTREE
  ADD CONSTRAINT SQL060921094229350 PRIMARY KEY (TREESET_ID, TREE_ORDER);

CREATE TABLE TBASE2.TREETYPE
  (TREETYPE_ID BIGINT NOT NULL,
   VERSION INTEGER,
   DESCRIPTION VARCHAR(255));

ALTER TABLE TBASE2.TREETYPE
  ADD CONSTRAINT SQL060921094229370 PRIMARY KEY (TREETYPE_ID);

CREATE TABLE TBASE2.TYPESET
  (TYPESET_ID BIGINT NOT NULL,
   VERSION INTEGER,
   TITLE VARCHAR(255),
   MATRIX_ID BIGINT);

ALTER TABLE TBASE2.TYPESET
  ADD CONSTRAINT SQL060921094229390 PRIMARY KEY (TYPESET_ID);

CREATE TABLE TBASE2.USER
  (USER_ID BIGINT NOT NULL,
   VERSION INTEGER,
   USERNAME VARCHAR(100) NOT NULL,
   PASSWORD VARCHAR(100) NOT NULL,
   USERROLE_ID BIGINT NOT NULL,
   PERSON_ID BIGINT NOT NULL);

ALTER TABLE TBASE2.USER
  ADD CONSTRAINT SQL060921094229450 PRIMARY KEY (USER_ID);

ALTER TABLE TBASE2.USER
  ADD CONSTRAINT SQL060921094229451 UNIQUE();

ALTER TABLE TBASE2.USER
  ADD CONSTRAINT SQL060512164423660 UNIQUE(USERNAME);

CREATE TABLE TBASE2.USERROLE
  (USERROLE_ID BIGINT NOT NULL,
   VERSION INTEGER,
   AUTHORITY VARCHAR(255) NOT NULL);

ALTER TABLE TBASE2.USERROLE
  ADD CONSTRAINT SQL060921094229470 PRIMARY KEY (USERROLE_ID);

CREATE TABLE TBASE2.USERTYPE
  (TYPE CHARACTER(1) NOT NULL,
   USERTYPE_ID BIGINT NOT NULL,
   VERSION INTEGER,
   TITLE VARCHAR(255));

ALTER TABLE TBASE2.USERTYPE
  ADD CONSTRAINT SQL060921094229490 PRIMARY KEY (USERTYPE_ID);

CREATE TABLE TBASE2.USERTYPERECORD
  (USERTYPERECORD_ID BIGINT NOT NULL,
   VERSION INTEGER,
   PHYLOCHAR_ID BIGINT,
   USERTYPE_ID BIGINT,
   TYPESET_ID BIGINT);

ALTER TABLE TBASE2.USERTYPERECORD
  ADD CONSTRAINT SQL060921094229520 PRIMARY KEY (USERTYPERECORD_ID);

ALTER TABLE TBASE2.ALGORITHM
  ADD CONSTRAINT FKB388C44FC6E814E6 FOREIGN KEY (GAPMODE_ID)
  REFERENCES TBASE2.GAPMODE(GAPMODE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.ALGORITHM
  ADD CONSTRAINT FKB388C44F9698D32E FOREIGN KEY (POLYTCOUNT_ID)
  REFERENCES TBASE2.POLYTCOUNT(POLYTCOUNT_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.ALGORITHM
  ADD CONSTRAINT FKB388C44F92E6A38E FOREIGN KEY (USERTYPE_ID)
  REFERENCES TBASE2.USERTYPE(USERTYPE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.ANALYSIS
  ADD CONSTRAINT FKF19622DC3C572C3C FOREIGN KEY (STUDY_ID)
  REFERENCES TBASE2.STUDY(STUDY_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.ANALYSISSTEP
  ADD CONSTRAINT FK21F853A848A2817C FOREIGN KEY (ALGORITHM_ID)
  REFERENCES TBASE2.ALGORITHM(ALGORITHM_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.ANALYSISSTEP
  ADD CONSTRAINT FK21F853A8D1884DD8 FOREIGN KEY (ANALYSIS_ID)
  REFERENCES TBASE2.ANALYSIS(ANALYSIS_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.ANALYSISSTEP
  ADD CONSTRAINT FK21F853A865EDD5F8 FOREIGN KEY (SOFTWARE_ID)
  REFERENCES TBASE2.SOFTWARE(SOFTWARE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.ANALYZEDDATA
  ADD CONSTRAINT FK8C9618424BA97F78 FOREIGN KEY (ANALYSISSTEP_ID)
  REFERENCES TBASE2.ANALYSISSTEP(ANALYSISSTEP_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.ANALYZEDDATA
  ADD CONSTRAINT FK8C96184255961AEE FOREIGN KEY (MATRIX_ID)
  REFERENCES TBASE2.MATRIX(MATRIX_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.ANALYZEDDATA
  ADD CONSTRAINT FK8C961842B710CB23 FOREIGN KEY (PHYLOTREE_ID)
  REFERENCES TBASE2.PHYLOTREE(PHYLOTREE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.ANCESTRALSTATE
  ADD CONSTRAINT FK3FA14284684F6406 FOREIGN KEY (ANCSTATESET_ID)
  REFERENCES TBASE2.ANCSTATESET(ANCSTATESET_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.ANCESTRALSTATE
  ADD CONSTRAINT FK3FA14284F4803CE6 FOREIGN KEY (DISCRETECHARSTATE_ID)
  REFERENCES TBASE2.DISCRETECHARSTATE(DISCRETECHARSTATE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.ANCSTATESET
  ADD CONSTRAINT FK879339E7A414944F FOREIGN KEY (MATRIX_ID)
  REFERENCES TBASE2.MATRIX(MATRIX_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CHARGROUP
  ADD CONSTRAINT FK3AF18C91AA11DC6 FOREIGN KEY (CHARPARTITION_ID)
  REFERENCES TBASE2.CHARPARTITION(CHARPARTITION_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CHARGROUP_PHYLOCHAR
  ADD CONSTRAINT FKEB6D7004971FFFA6 FOREIGN KEY (CHARGROUP_ID)
  REFERENCES TBASE2.CHARGROUP(CHARGROUP_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CHARGROUP_PHYLOCHAR
  ADD CONSTRAINT FKEB6D7004F5DECA46 FOREIGN KEY (PHYLOCHAR_ID)
  REFERENCES TBASE2.PHYLOCHAR(PHYLOCHAR_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CHARSET
  ADD CONSTRAINT FK56D8ED2CA414944F FOREIGN KEY (MATRIX_ID)
  REFERENCES TBASE2.MATRIX(MATRIX_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CHARWEIGHT
  ADD CONSTRAINT FK8CC7694EE9B425A6 FOREIGN KEY (CHARWEIGHTSET_ID)
  REFERENCES TBASE2.CHARWEIGHTSET(CHARWEIGHTSET_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CHARWEIGHT
  ADD CONSTRAINT FK8CC7694EF5DECA46 FOREIGN KEY (PHYLOCHAR_ID)
  REFERENCES TBASE2.PHYLOCHAR(PHYLOCHAR_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CHARWEIGHTSET
  ADD CONSTRAINT FK99B8AC34A414944F FOREIGN KEY (MATRIX_ID)
  REFERENCES TBASE2.MATRIX(MATRIX_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CITATION_AUTHOR
  ADD CONSTRAINT FK24AA55E38E1E4DF8 FOREIGN KEY (CITATION_ID)
  REFERENCES TBASE2.CITATION(CITATION_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CITATION_AUTHOR
  ADD CONSTRAINT FK24AA55E36707573B FOREIGN KEY (AUTHORS_PERSON_ID)
  REFERENCES TBASE2.PERSON(PERSON_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CITATION_EDITOR
  ADD CONSTRAINT FK2A8955C5EC93F501 FOREIGN KEY (CITATION_ID)
  REFERENCES TBASE2.CITATION(CITATION_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CITATION_EDITOR
  ADD CONSTRAINT FK2A8955C568F6F619 FOREIGN KEY (EDITORS_PERSON_ID)
  REFERENCES TBASE2.PERSON(PERSON_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CODERECORD_COLRANGE
  ADD CONSTRAINT FKA3E6C61E79A523E6 FOREIGN KEY (COLUMNRANGE_ID)
  REFERENCES TBASE2.COLUMNRANGE(COLUMNRANGE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CODERECORD_COLRANGE
  ADD CONSTRAINT FKA3E6C61EDC51C546 FOREIGN KEY (GENETICCODERECORD_ID)
  REFERENCES TBASE2.GENETICCODERECORD(GENETICCODERECORD_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CODONCHAR1_COLRANGE
  ADD CONSTRAINT FKDA5AD4F8491DB20E FOREIGN KEY (CODONPOSITIONSET_ID)
  REFERENCES TBASE2.CODONPOSITIONSET(CODONPOSITIONSET_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CODONCHAR1_COLRANGE
  ADD CONSTRAINT FKDA5AD4F879A523E6 FOREIGN KEY (COLUMNRANGE_ID)
  REFERENCES TBASE2.COLUMNRANGE(COLUMNRANGE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CODONCHAR2_COLRANGE
  ADD CONSTRAINT FKCEA44617491DB20E FOREIGN KEY (CODONPOSITIONSET_ID)
  REFERENCES TBASE2.CODONPOSITIONSET(CODONPOSITIONSET_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CODONCHAR2_COLRANGE
  ADD CONSTRAINT FKCEA4461779A523E6 FOREIGN KEY (COLUMNRANGE_ID)
  REFERENCES TBASE2.COLUMNRANGE(COLUMNRANGE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CODONCHAR3_COLRANGE
  ADD CONSTRAINT FKC2EDB736491DB20E FOREIGN KEY (CODONPOSITIONSET_ID)
  REFERENCES TBASE2.CODONPOSITIONSET(CODONPOSITIONSET_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CODONCHAR3_COLRANGE
  ADD CONSTRAINT FKC2EDB73679A523E6 FOREIGN KEY (COLUMNRANGE_ID)
  REFERENCES TBASE2.COLUMNRANGE(COLUMNRANGE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CODONNONCODING_COLRANGE
  ADD CONSTRAINT FK307897FC491DB20E FOREIGN KEY (CODONPOSITIONSET_ID)
  REFERENCES TBASE2.CODONPOSITIONSET(CODONPOSITIONSET_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CODONNONCODING_COLRANGE
  ADD CONSTRAINT FK307897FC79A523E6 FOREIGN KEY (COLUMNRANGE_ID)
  REFERENCES TBASE2.COLUMNRANGE(COLUMNRANGE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CODONPOSITIONSET
  ADD CONSTRAINT FK4E501CC2A414944F FOREIGN KEY (MATRIX_ID)
  REFERENCES TBASE2.MATRIX(MATRIX_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.COMPOUND_ELEMENT
  ADD CONSTRAINT FK31183048459091E5 FOREIGN KEY (ELEMENT_ID)
  REFERENCES TBASE2.MATRIXELEMENT(MATRIXELEMENT_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.COMPOUND_ELEMENT
  ADD CONSTRAINT FK311830485F4F7CEB FOREIGN KEY (COMPOUND_ID)
  REFERENCES TBASE2.MATRIXELEMENT(MATRIXELEMENT_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CONTANCSTATE_VALUE
  ADD CONSTRAINT FKA84B8C3FD450D2BD FOREIGN KEY (ANCSTATE_ID)
  REFERENCES TBASE2.ANCESTRALSTATE(ANCESTRALSTATE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CSTREENODE
  ADD CONSTRAINT FK82B9AB10F572A92 FOREIGN KEY (PARENTNODE_ID)
  REFERENCES TBASE2.CSTREENODE(CSTREENODE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CSTREENODE
  ADD CONSTRAINT FK82B9AB10F4803CE6 FOREIGN KEY (DISCRETECHARSTATE_ID)
  REFERENCES TBASE2.DISCRETECHARSTATE(DISCRETECHARSTATE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.CSTREENODE
  ADD CONSTRAINT FK82B9AB10C6999FCE FOREIGN KEY (CSTREE_ID)
  REFERENCES TBASE2.USERTYPE(USERTYPE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.DISCRETECHARSTATE
  ADD CONSTRAINT FK2EEF2802C7BEAAFE FOREIGN KEY (ANCESTRALSTATE_ID)
  REFERENCES TBASE2.ANCESTRALSTATE(ANCESTRALSTATE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.DISCRETECHARSTATE
  ADD CONSTRAINT FK2EEF2802FE41A723 FOREIGN KEY (PHYLOCHAR_ID)
  REFERENCES TBASE2.PHYLOCHAR(PHYLOCHAR_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.DISCRETECHARSTATE
  ADD CONSTRAINT FK2EEF2802163C67CE FOREIGN KEY (STATESET_ID)
  REFERENCES TBASE2.STATESET(STATESET_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.DISTANCEMATRIXELEMENT
  ADD CONSTRAINT FK92D3DDE64B8EF343 FOREIGN KEY (MATRIX_ID)
  REFERENCES TBASE2.MATRIX(MATRIX_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.DISTANCEMATRIXELEMENT
  ADD CONSTRAINT FK92D3DDE61F08BAE7 FOREIGN KEY (ROWLABEL_ID)
  REFERENCES TBASE2.TAXONLABEL(TAXONLABEL_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.DISTANCEMATRIXELEMENT
  ADD CONSTRAINT FK92D3DDE6C1429863 FOREIGN KEY (COLUMNLABEL_ID)
  REFERENCES TBASE2.TAXONLABEL(TAXONLABEL_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.GENETICCODERECORD
  ADD CONSTRAINT FK237932B76CB73FC6 FOREIGN KEY (GENETICCODE_ID)
  REFERENCES TBASE2.GENETICCODE(GENETICCODE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.GENETICCODERECORD
  ADD CONSTRAINT FK237932B782D8ECCE FOREIGN KEY (GENETICCODESET_ID)
  REFERENCES TBASE2.GENETICCODESET(GENETICCODESET_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.GENETICCODESET
  ADD CONSTRAINT FK6A12F7DCA414944F FOREIGN KEY (MATRIX_ID)
  REFERENCES TBASE2.MATRIX(MATRIX_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.ITEMVALUE
  ADD CONSTRAINT FK27B41A1E405A7CEE FOREIGN KEY (ITEMDEFINITION_ID)
  REFERENCES TBASE2.ITEMDEFINITION(ITEMDEFINITION_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.ITEMVALUE
  ADD CONSTRAINT FK27B41A1E459091E5 FOREIGN KEY (ELEMENT_ID)
  REFERENCES TBASE2.MATRIXELEMENT(MATRIXELEMENT_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.LEFTCHANGESET_CHARSTATE
  ADD CONSTRAINT FKC8877207F4803CE6 FOREIGN KEY (DISCRETECHARSTATE_ID)
  REFERENCES TBASE2.DISCRETECHARSTATE(DISCRETECHARSTATE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.LEFTCHANGESET_CHARSTATE
  ADD CONSTRAINT FKC887720775763EAE FOREIGN KEY (STATECHANGESET_ID)
  REFERENCES TBASE2.STATECHANGESET(STATECHANGESET_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.MATRIX
  ADD CONSTRAINT FK87208BC1684F6406 FOREIGN KEY (ANCSTATESET_ID)
  REFERENCES TBASE2.ANCSTATESET(ANCSTATESET_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.MATRIX
  ADD CONSTRAINT FK87208BC145534A9C FOREIGN KEY (CHARSET_ID)
  REFERENCES TBASE2.CHARSET(CHARSET_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.MATRIX
  ADD CONSTRAINT FK87208BC1E9B425A6 FOREIGN KEY (CHARWEIGHTSET_ID)
  REFERENCES TBASE2.CHARWEIGHTSET(CHARWEIGHTSET_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.MATRIX
  ADD CONSTRAINT FK87208BC1491DB20E FOREIGN KEY (CODONPOSITIONSET_ID)
  REFERENCES TBASE2.CODONPOSITIONSET(CODONPOSITIONSET_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.MATRIX
  ADD CONSTRAINT FK87208BC14CE484AE FOREIGN KEY (MATRIXDATATYPE_ID)
  REFERENCES TBASE2.MATRIXDATATYPE(MATRIXDATATYPE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.MATRIX
  ADD CONSTRAINT FK87208BC14D737E46 FOREIGN KEY (TYPESET_ID)
  REFERENCES TBASE2.TYPESET(TYPESET_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.MATRIXCOLUMN
  ADD CONSTRAINT FK9B0BE57A414944F FOREIGN KEY (MATRIX_ID)
  REFERENCES TBASE2.MATRIX(MATRIX_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.MATRIXCOLUMN
  ADD CONSTRAINT FK9B0BE57F5DECA46 FOREIGN KEY (PHYLOCHAR_ID)
  REFERENCES TBASE2.PHYLOCHAR(PHYLOCHAR_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.MATRIXCOLUMN
  ADD CONSTRAINT FK9B0BE57BED40086 FOREIGN KEY (STATEFORMAT_ID)
  REFERENCES TBASE2.STATEFORMAT(STATEFORMAT_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.MATRIXCOLUMN_ITEMDEFINITION
  ADD CONSTRAINT FKB556F8E405A7CEE FOREIGN KEY (ITEMDEFINITION_ID)
  REFERENCES TBASE2.ITEMDEFINITION(ITEMDEFINITION_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.MATRIXCOLUMN_ITEMDEFINITION
  ADD CONSTRAINT FKB556F8E8B2E884E FOREIGN KEY (MATRIXCOLUMN_ID)
  REFERENCES TBASE2.MATRIXCOLUMN(MATRIXCOLUMN_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.MATRIXDATATYPE
  ADD CONSTRAINT FKF054C4A5F5DECA46 FOREIGN KEY (PHYLOCHAR_ID)
  REFERENCES TBASE2.PHYLOCHAR(PHYLOCHAR_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.MATRIXELEMENT
  ADD CONSTRAINT FK90AE93FBF4803CE6 FOREIGN KEY (DISCRETECHARSTATE_ID)
  REFERENCES TBASE2.DISCRETECHARSTATE(DISCRETECHARSTATE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.MATRIXELEMENT
  ADD CONSTRAINT FK90AE93FB8B2E884E FOREIGN KEY (MATRIXCOLUMN_ID)
  REFERENCES TBASE2.MATRIXCOLUMN(MATRIXCOLUMN_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.MATRIXELEMENT
  ADD CONSTRAINT FK90AE93FBE7B3CDA6 FOREIGN KEY (MATRIXROW_ID)
  REFERENCES TBASE2.MATRIXROW(MATRIXROW_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.MATRIXROW
  ADD CONSTRAINT FKE4688E59F603500B FOREIGN KEY (MATRIX_ID)
  REFERENCES TBASE2.MATRIX(MATRIX_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.MATRIXROW
  ADD CONSTRAINT FKE4688E5963AB9FD7 FOREIGN KEY (TAXONLABEL_ID)
  REFERENCES TBASE2.TAXONLABEL(TAXONLABEL_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.PHYLOCHAR
  ADD CONSTRAINT FK76EB03FA416D5B50 FOREIGN KEY (CHARSET_ID)
  REFERENCES TBASE2.CHARSET(CHARSET_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.PHYLOTREE
  ADD CONSTRAINT FK76F2E442F3D1CF03 FOREIGN KEY (ROOTNODE_ID)
  REFERENCES TBASE2.PHYLOTREENODE(PHYLOTREENODE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.PHYLOTREE
  ADD CONSTRAINT FK76F2E442A3015CE3 FOREIGN KEY (TREEATTRIBUTE_ID)
  REFERENCES TBASE2.TREEATTRIBUTE(TREEATTRIBUTE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.PHYLOTREE
  ADD CONSTRAINT FK76F2E442EA08B443 FOREIGN KEY (TREEQUALITY_ID)
  REFERENCES TBASE2.TREEQUALITY(TREEQUALITY_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.PHYLOTREE
  ADD CONSTRAINT FK76F2E442F5AEA931 FOREIGN KEY (TREETYPE_ID)
  REFERENCES TBASE2.TREETYPE(TREETYPE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.PHYLOTREENODE
  ADD CONSTRAINT FK3EA79944271A5763 FOREIGN KEY (NODEATTRIBUTE_ID)
  REFERENCES TBASE2.NODEATTRIBUTE(NODEATTRIBUTE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.PHYLOTREENODE
  ADD CONSTRAINT FK3EA79944B710CB23 FOREIGN KEY (PHYLOTREE_ID)
  REFERENCES TBASE2.PHYLOTREE(PHYLOTREE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.PHYLOTREENODE
  ADD CONSTRAINT FK3EA799443C348165 FOREIGN KEY (SIBLING_ID)
  REFERENCES TBASE2.PHYLOTREENODE(PHYLOTREENODE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.PHYLOTREENODE
  ADD CONSTRAINT FK3EA79944434FDCCB FOREIGN KEY (CHILD_ID)
  REFERENCES TBASE2.PHYLOTREENODE(PHYLOTREENODE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.PHYLOTREENODE
  ADD CONSTRAINT FK3EA7994463AB9FD7 FOREIGN KEY (TAXONLABEL_ID)
  REFERENCES TBASE2.TAXONLABEL(TAXONLABEL_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.RIGHTCHANGESET_CHARSTATE
  ADD CONSTRAINT FKC8AFC9F2F4803CE6 FOREIGN KEY (DISCRETECHARSTATE_ID)
  REFERENCES TBASE2.DISCRETECHARSTATE(DISCRETECHARSTATE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.RIGHTCHANGESET_CHARSTATE
  ADD CONSTRAINT FKC8AFC9F275763EAE FOREIGN KEY (STATECHANGESET_ID)
  REFERENCES TBASE2.STATECHANGESET(STATECHANGESET_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.ROWSEGMENT
  ADD CONSTRAINT FKEE9AE819E7B3CDA6 FOREIGN KEY (MATRIXROW_ID)
  REFERENCES TBASE2.MATRIXROW(MATRIXROW_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.ROWSEGMENT
  ADD CONSTRAINT FKEE9AE819649E2E7D FOREIGN KEY (SPECIMENLABEL_ID)
  REFERENCES TBASE2.SPECIMENLABEL(SPECIMENLABEL_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.SPECIMEN
  ADD CONSTRAINT FKAF84F308A2039B9D FOREIGN KEY (GEOSPOT_ID)
  REFERENCES TBASE2.GEOSPOT(GEOSPOT_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.SPECIMEN
  ADD CONSTRAINT FKAF84F3081DE2FCDD FOREIGN KEY (TAXON_ID)
  REFERENCES TBASE2.TAXON(TAXON_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.SPECIMENLABEL
  ADD CONSTRAINT FK1E8F38CC6D4F5E77 FOREIGN KEY (SPECIMEN_ID)
  REFERENCES TBASE2.SPECIMEN(SPECIMEN_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.STATEMODIFIER
  ADD CONSTRAINT FKD157BE48F4803CE6 FOREIGN KEY (DISCRETECHARSTATE_ID)
  REFERENCES TBASE2.DISCRETECHARSTATE(DISCRETECHARSTATE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.STATEMODIFIER
  ADD CONSTRAINT FKD157BE48459091E5 FOREIGN KEY (ELEMENT_ID)
  REFERENCES TBASE2.MATRIXELEMENT(MATRIXELEMENT_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.STATEMODIFIER
  ADD CONSTRAINT FKD157BE48BED40086 FOREIGN KEY (STATEFORMAT_ID)
  REFERENCES TBASE2.STATEFORMAT(STATEFORMAT_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.STATESET
  ADD CONSTRAINT FK7D38523150CBAB47 FOREIGN KEY (MATRIX_ID)
  REFERENCES TBASE2.MATRIX(MATRIX_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.STEPMATRIXELEMENT
  ADD CONSTRAINT FK891100AF6E972A88 FOREIGN KEY (STATE1_ID)
  REFERENCES TBASE2.DISCRETECHARSTATE(DISCRETECHARSTATE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.STEPMATRIXELEMENT
  ADD CONSTRAINT FK891100AF6E979EE7 FOREIGN KEY (STATE2_ID)
  REFERENCES TBASE2.DISCRETECHARSTATE(DISCRETECHARSTATE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.STEPMATRIXELEMENT
  ADD CONSTRAINT FK891100AF9E8198E FOREIGN KEY (STEPMATRIX_ID)
  REFERENCES TBASE2.USERTYPE(USERTYPE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.STUDY
  ADD CONSTRAINT FK4B915A98E1E4DF8 FOREIGN KEY (CITATION_ID)
  REFERENCES TBASE2.CITATION(CITATION_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.STUDY
  ADD CONSTRAINT FK4B915A9255A519C FOREIGN KEY (STUDYSTATUS_ID)
  REFERENCES TBASE2.STUDYSTATUS(STUDYSTATUS_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.SUB_MATRIX
  ADD CONSTRAINT FK5F26A2C055961AEE FOREIGN KEY (MATRIX_ID)
  REFERENCES TBASE2.MATRIX(MATRIX_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.SUB_MATRIX
  ADD CONSTRAINT FK5F26A2C08DFE4858 FOREIGN KEY (SUBMISSION_ID)
  REFERENCES TBASE2.SUBMISSION(SUBMISSION_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.SUB_PHLYOTREE
  ADD CONSTRAINT FKCA1EF6A9B710CB23 FOREIGN KEY (PHYLOTREE_ID)
  REFERENCES TBASE2.PHYLOTREE(PHYLOTREE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.SUB_PHLYOTREE
  ADD CONSTRAINT FKCA1EF6A98DFE4858 FOREIGN KEY (SUBMISSION_ID)
  REFERENCES TBASE2.SUBMISSION(SUBMISSION_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.SUB_TAXONLABEL
  ADD CONSTRAINT FK86909E98DFE4858 FOREIGN KEY (SUBMISSION_ID)
  REFERENCES TBASE2.SUBMISSION(SUBMISSION_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.SUB_TAXONLABEL
  ADD CONSTRAINT FK86909E963AB9FD7 FOREIGN KEY (TAXONLABEL_ID)
  REFERENCES TBASE2.TAXONLABEL(TAXONLABEL_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.SUBMISSION
  ADD CONSTRAINT FKA120274C3C572C3C FOREIGN KEY (STUDY_ID)
  REFERENCES TBASE2.STUDY(STUDY_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.SUBMISSION
  ADD CONSTRAINT FKA120274CBEF300B2 FOREIGN KEY (USER_ID)
  REFERENCES TBASE2.USER(USER_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.TAXONLABEL
  ADD CONSTRAINT FK5F548A6A3C572C3C FOREIGN KEY (STUDY_ID)
  REFERENCES TBASE2.STUDY(STUDY_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.TAXONLABEL
  ADD CONSTRAINT FK5F548A6A1DE2FCDD FOREIGN KEY (TAXON_ID)
  REFERENCES TBASE2.TAXON(TAXON_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.TAXONLABELGROUP
  ADD CONSTRAINT FK4AE2663513A813DD FOREIGN KEY (TAXONLABELPARTITION_ID)
  REFERENCES TBASE2.TAXONLABELPARTITION(TAXONLABELPARTITION_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.TAXONLABELROUP_TAXONLABEL
  ADD CONSTRAINT FK4B1D0BC763AB9FD7 FOREIGN KEY (TAXONLABEL_ID)
  REFERENCES TBASE2.TAXONLABEL(TAXONLABEL_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.TAXONLABELROUP_TAXONLABEL
  ADD CONSTRAINT FK4B1D0BC7294B993D FOREIGN KEY (TAXONLABELGROUP_ID)
  REFERENCES TBASE2.TAXONLABELGROUP(TAXONLABELGROUP_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.TAXONLABELSET
  ADD CONSTRAINT FK28D3A5983C572C3C FOREIGN KEY (STUDY_ID)
  REFERENCES TBASE2.STUDY(STUDY_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.TAXONLABELSET_TAXONLABEL
  ADD CONSTRAINT FK2EB54B7163AB9FD7 FOREIGN KEY (TAXONLABEL_ID)
  REFERENCES TBASE2.TAXONLABEL(TAXONLABEL_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.TAXONLABELSET_TAXONLABEL
  ADD CONSTRAINT FK2EB54B71E310471D FOREIGN KEY (TAXONLABELSET_ID)
  REFERENCES TBASE2.TAXONLABELSET(TAXONLABELSET_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.TAXONLINK
  ADD CONSTRAINT FKC102D9A41DE2FCDD FOREIGN KEY (TAXON_ID)
  REFERENCES TBASE2.TAXON(TAXON_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.TAXONLINK
  ADD CONSTRAINT FKC102D9A43BF5F2F7 FOREIGN KEY (TAXONAUTHORITY_ID)
  REFERENCES TBASE2.TAXONAUTHORITY(TAXONAUTHORITY_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.TAXONSET_TAXON
  ADD CONSTRAINT FKC656C9031DE2FCDD FOREIGN KEY (TAXON_ID)
  REFERENCES TBASE2.TAXON(TAXON_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.TAXONSET_TAXON
  ADD CONSTRAINT FKC656C90313C28457 FOREIGN KEY (TAXONSET_ID)
  REFERENCES TBASE2.TAXONSET(TAXONSET_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.TREEGROUP
  ADD CONSTRAINT FKA870258180CBD223 FOREIGN KEY (TREEPARTITION_ID)
  REFERENCES TBASE2.TREEPARTITION(TREEPARTITION_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.TREEGROUP_PHYLOTREE
  ADD CONSTRAINT FKFB7D704B710CB23 FOREIGN KEY (PHYLOTREE_ID)
  REFERENCES TBASE2.PHYLOTREE(PHYLOTREE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.TREEGROUP_PHYLOTREE
  ADD CONSTRAINT FKFB7D7045E56A83 FOREIGN KEY (TREEGROUP_ID)
  REFERENCES TBASE2.TREEGROUP(TREEGROUP_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.TREENODEEDGE
  ADD CONSTRAINT FK7767285D1851763B FOREIGN KEY (PARENTNODE_ID)
  REFERENCES TBASE2.PHYLOTREENODE(PHYLOTREENODE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.TREENODEEDGE
  ADD CONSTRAINT FK7767285D27FD0589 FOREIGN KEY (CHILDNODE_ID)
  REFERENCES TBASE2.PHYLOTREENODE(PHYLOTREENODE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.TREESET_PHYLOTREE
  ADD CONSTRAINT FK31FC19A7B710CB23 FOREIGN KEY (PHYLOTREE_ID)
  REFERENCES TBASE2.PHYLOTREE(PHYLOTREE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.TREESET_PHYLOTREE
  ADD CONSTRAINT FK31FC19A7EC59B1E3 FOREIGN KEY (TREESET_ID)
  REFERENCES TBASE2.TREESET(TREESET_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.TYPESET
  ADD CONSTRAINT FKF7F2B6C8A414944F FOREIGN KEY (MATRIX_ID)
  REFERENCES TBASE2.MATRIX(MATRIX_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.USER
  ADD CONSTRAINT FK27E3CBE3910672 FOREIGN KEY (PERSON_ID)
  REFERENCES TBASE2.PERSON(PERSON_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.USER
  ADD CONSTRAINT FK27E3CBF59DD12 FOREIGN KEY (USERROLE_ID)
  REFERENCES TBASE2.USERROLE(USERROLE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.USERTYPERECORD
  ADD CONSTRAINT FK136AF616F5DECA46 FOREIGN KEY (PHYLOCHAR_ID)
  REFERENCES TBASE2.PHYLOCHAR(PHYLOCHAR_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.USERTYPERECORD
  ADD CONSTRAINT FK136AF6164D737E46 FOREIGN KEY (TYPESET_ID)
  REFERENCES TBASE2.TYPESET(TYPESET_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

ALTER TABLE TBASE2.USERTYPERECORD
  ADD CONSTRAINT FK136AF61692E6A38E FOREIGN KEY (USERTYPE_ID)
  REFERENCES TBASE2.USERTYPE(USERTYPE_ID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;