<?xml version="1.0" encoding="UTF-8"?><database name="ada" schema="public" type="PostgreSQL - 14.6">
   <sequences>
      <sequence increment="1" name="curators_id_seq" startValue="1"/>
      <sequence increment="1" name="external_identifier_schemes_id_seq" startValue="1"/>
      <sequence increment="1" name="file_extensions_id_seq" startValue="1"/>
      <sequence increment="1" name="funders_id_seq" startValue="1"/>
      <sequence increment="1" name="licenses_id_seq" startValue="1"/>
      <sequence increment="1" name="name_entities_id_seq" startValue="1"/>
      <sequence increment="1" name="name_entity_identifiers_id_seq" startValue="1"/>
      <sequence increment="1" name="record_contributors_id_seq" startValue="1"/>
      <sequence increment="1" name="record_creators_id_seq" startValue="1"/>
      <sequence increment="1" name="record_files_id_seq" startValue="1"/>
      <sequence increment="1" name="record_fundings_id_seq" startValue="1"/>
      <sequence increment="1" name="record_licenses_id_seq" startValue="1"/>
      <sequence increment="1" name="record_subjects_id_seq" startValue="1"/>
      <sequence increment="1" name="record_trails_id_seq" startValue="1"/>
      <sequence increment="1" name="records_id_seq" startValue="1"/>
      <sequence increment="1" name="subject_schemes_id_seq" startValue="1"/>
   </sequences>
   <tables>
      <table name="curators" remarks="Table to hold curators with role" schema="public" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('curators_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="name_entity_id" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="'Curate'::text" digits="0" id="2" name="role" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="3" name="created_at" nullable="false" remarks="" size="29" type="timestamp" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="4" name="updated_at" nullable="false" remarks="" size="29" type="timestamp" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="curators_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="curators_name_id_key" unique="true">
            <column ascending="true" name="name_entity_id"/>
         </index>
         <checkConstraint constraint="((role = ANY (ARRAY['Curate'::text, 'Maintain'::text, 'Admin'::text])))" name="curators_role_check"/>
      </table>
      <table name="external_identifier_schemes" remarks="Table to hold different identifier scheme infomation allowed by ADA system" schema="public" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('external_identifier_schemes_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4">
            <child column="external_identifier_scheme_id" foreignKey="name_entity_identifiers_external_identifier_scheme_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="name_entity_identifiers"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="name" nullable="false" remarks="The name of the identifier scheme, e.g. DOI, ORCID, ROR, etc." size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="url" nullable="true" remarks="The URL of the identifier scheme, e.g. https://doi.org" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="description" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="4" name="created_at" nullable="false" remarks="Indicate when the identifier scheme was created" size="29" type="timestamp" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="5" name="updated_at" nullable="false" remarks="Indicate when the identifier scheme was last updated" size="29" type="timestamp" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="external_identifier_scheme_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="external_identifier_scheme_scheme_name_key" unique="true">
            <column ascending="true" name="name"/>
         </index>
      </table>
      <table name="file_extensions" remarks="Table to hold different file name extensions allowed by ADA system" schema="public" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('file_extensions_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4">
            <child column="file_extension_id" foreignKey="record_files_file_extension_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="record_files"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="extension" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="type_name" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="media_type" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="description_url" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="5" name="created_at" nullable="false" remarks="Indicate when the file extension was created" size="29" type="timestamp" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="6" name="updated_at" nullable="false" remarks="Indicate when the file extension was last updated" size="29" type="timestamp" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="file_extensions_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="file_extensions_file_extension_key" unique="true">
            <column ascending="true" name="extension"/>
         </index>
      </table>
      <table name="funders" remarks="Table to hold different funder information allowed by ADA system" schema="public" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('funders_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4">
            <child column="funder_id" foreignKey="record_fundings_funder_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="record_fundings"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="abbreviation" nullable="false" remarks="Abbreviation of the funder name" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="name" nullable="false" remarks="datacite:funderName" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="url" nullable="false" remarks="datacite:funderIdentifier" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="4" name="created_at" nullable="false" remarks="Indicate when the funder was created" size="29" type="timestamp" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="5" name="updated_at" nullable="false" remarks="Indicate when the funder was last updated" size="29" type="timestamp" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="funder_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="funder_funder_abbrev_key" unique="true">
            <column ascending="true" name="abbreviation"/>
         </index>
      </table>
      <table name="licenses" remarks="Table to hold different license information allowed by ADA system" schema="public" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('licenses_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4">
            <child column="license_id" foreignKey="record_licenses_license_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="record_licenses"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="abbreviation" nullable="false" remarks="datacite:rightsIdentifier" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="name" nullable="false" remarks="datacite:Rights" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="url" nullable="false" remarks="datacite:rightsURI" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="4" name="created_at" nullable="false" remarks="Indicate when the license was created" size="29" type="timestamp" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="5" name="updated_at" nullable="false" remarks="Indicate when the license was last updated" size="29" type="timestamp" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="license_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="license_license_abbrev_key" unique="true">
            <column ascending="true" name="abbreviation"/>
         </index>
      </table>
      <table name="name_entities" remarks="Table to hold different personal or organizational names" schema="public" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('name_entities_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4">
            <child column="name_entity_id" foreignKey="name_entitie_identifiers_name_entity_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="name_entity_identifiers"/>
            <child column="name_entity_id" foreignKey="record_contributors_name_entity_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="record_contributors"/>
            <child column="name_entity_id" foreignKey="record_creators_name_entity_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="record_creators"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="full_name" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="'Personal'::text" digits="0" id="2" name="name_type" nullable="false" remarks="datacite:nameType" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="family_name" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="given_name" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="5" name="created_at" nullable="false" remarks="" size="29" type="timestamp" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="6" name="updated_at" nullable="false" remarks="" size="29" type="timestamp" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="name_entities_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <checkConstraint constraint="((name_type = ANY (ARRAY['Personal'::text, 'Organizational'::text])))" name="name_entities_name_type_check"/>
      </table>
      <table name="name_entity_identifiers" remarks="Table to hold identifiers of person or organization" schema="public" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('name_entity_identifiers_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="name_entity_id" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="name_entitie_identifiers_name_entity_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="name_entities"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="external_identifier_scheme_id" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="name_entity_identifiers_external_identifier_scheme_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="external_identifier_schemes"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="identifier" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="4" name="created_at" nullable="false" remarks="" size="29" type="timestamp" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="5" name="updated_at" nullable="false" remarks="" size="29" type="timestamp" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="name_entitie_identifiers_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
      </table>
      <table name="record_contributors" remarks="Table to hold contributors of the datasets" schema="public" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('record_contributors_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="record_id" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="record_contributors_record_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="records"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="name_entity_id" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="record_contributors_name_entity_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="name_entities"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="contributor_type" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="4" name="created_at" nullable="false" remarks="" size="29" type="timestamp" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="5" name="updated_at" nullable="false" remarks="" size="29" type="timestamp" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="record_contributors_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="record_contributors_record_id_name_id_key" unique="true">
            <column ascending="true" name="record_id"/>
            <column ascending="true" name="name_entity_id"/>
         </index>
         <checkConstraint constraint="((contributor_type = ANY (ARRAY['ContactPerson'::text, 'DataCollector'::text, 'DataCurator'::text, 'DataManager'::text, 'Distributor'::text, 'Editor'::text, 'HostingInstitution'::text, 'Producer'::text, 'ProjectLeader'::text, 'ProjectManager'::text, 'ProjectMember'::text, 'RegistrationAgency'::text, 'RegistrationAuthority'::text, 'RelatedPerson'::text, 'Researcher'::text, 'ResearchGroup'::text, 'RightsHolder'::text, 'Sponsor'::text, 'Supervisor'::text, 'WorkPackageLeader'::text, 'Other'::text])))" name="record_contributors_contributor_type_check"/>
      </table>
      <table name="record_creators" remarks="Table to hold creators of the datasets" schema="public" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('record_creators_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="record_id" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="record_creators_record_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="records"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="name_entity_id" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="record_creators_name_entity_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="name_entities"/>
         </column>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="3" name="created_at" nullable="false" remarks="" size="29" type="timestamp" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="4" name="updated_at" nullable="false" remarks="" size="29" type="timestamp" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="record_creators_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="record_creators_record_id_name_id_key" unique="true">
            <column ascending="true" name="record_id"/>
            <column ascending="true" name="name_entity_id"/>
         </index>
      </table>
      <table name="record_files" remarks="Table to hold metadata of the file related to the datasets" schema="public" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('record_files_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="record_id" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="record_files_record_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="records"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="name" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="checksum" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="file_extension_id" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="record_files_file_extension_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="file_extensions"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="size_bytes" nullable="false" remarks="" size="19" type="int8" typeCode="-5"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="general_type" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="7" name="specific_type" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="8" name="created_at" nullable="false" remarks="" size="29" type="timestamp" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="9" name="updated_at" nullable="false" remarks="" size="29" type="timestamp" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="record_files_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <checkConstraint constraint="((general_type = ANY (ARRAY['image'::text, 'document'::text, 'tabularData'::text, 'dataCube'::text, 'dataCollection'::text, 'metadata'::text])))" name="record_files_general_type_check"/>
      </table>
      <table name="record_fundings" remarks="Table to hold funding information of the datasets" schema="public" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('record_fundings_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="record_id" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="record_fundings_record_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="records"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="funder_id" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="record_fundings_funder_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="funders"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="award_number" nullable="false" remarks="datacite:awardNumber, e.g. GBMF3859.01" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="award_title" nullable="true" remarks="datacite:awardTitle, e.g. Socioenvironmental Monitoring of the Amazon Basin and Xingu" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="award_url" nullable="true" remarks="datacite:awardURI, e.g. https://www.moore.org/grants/list/GBMF3859.01" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="6" name="created_at" nullable="false" remarks="" size="29" type="timestamp" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="7" name="updated_at" nullable="false" remarks="" size="29" type="timestamp" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="record_fundings_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="record_fundings_record_id_funder_id_award_num_key" unique="true">
            <column ascending="true" name="record_id"/>
            <column ascending="true" name="funder_id"/>
            <column ascending="true" name="award_number"/>
         </index>
      </table>
      <table name="record_licenses" remarks="Table to hold rights information of the datasets" schema="public" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('record_licenses_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="record_id" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="record_licenses_record_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="records"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="license_id" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="record_licenses_license_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="licenses"/>
         </column>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="3" name="created_at" nullable="false" remarks="" size="29" type="timestamp" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="4" name="updated_at" nullable="false" remarks="" size="29" type="timestamp" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="record_licenses_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
      </table>
      <table name="record_subjects" remarks="Table holding dataset-related subjects, stored in json format, conforming to approved json schemas" schema="public" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('record_subjects_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="record_id" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="record_subjects_record_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="records"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="subject_schema_id" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="record_subjects_subject_scheme_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="subject_schemas"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="subject" nullable="false" remarks="" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="4" name="created_at" nullable="false" remarks="" size="29" type="timestamp" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="5" name="updated_at" nullable="false" remarks="" size="29" type="timestamp" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="record_subjects_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="record_subjects_record_id_subject_scheme_id_subject_key" unique="true">
            <column ascending="true" name="record_id"/>
            <column ascending="true" name="subject_schema_id"/>
            <column ascending="true" name="subject"/>
         </index>
      </table>
      <table name="record_trails" remarks="Table to hold track infomation of the records" schema="public" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('record_trails_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="record_id" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="record_trails_record_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="records"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="status" nullable="false" remarks="Copy from records.process_status" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="3" name="status_on" nullable="false" remarks="Copy from records.updated_at" size="29" type="timestamp" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="record_trails_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
      </table>
      <table name="records" numRows="1" remarks="Table to hold core metada of the record" schema="public" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('records_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4">
            <child column="record_id" foreignKey="record_contributors_record_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="record_contributors"/>
            <child column="record_id" foreignKey="record_creators_record_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="record_creators"/>
            <child column="record_id" foreignKey="record_files_record_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="record_files"/>
            <child column="record_id" foreignKey="record_fundings_record_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="record_fundings"/>
            <child column="record_id" foreignKey="record_licenses_record_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="record_licenses"/>
            <child column="record_id" foreignKey="record_subjects_record_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="record_subjects"/>
            <child column="record_id" foreignKey="record_trails_record_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="record_trails"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="title" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="description" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="'Regular'::text" digits="0" id="3" name="submission_type" nullable="false" remarks="Indicate the record was submitted by an individual(Regular) or other data system, now only support SAMIS(BundleDelivery)" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="'Dataset'::text" digits="0" id="4" name="general_type" nullable="false" remarks="Part of datacite resourceTypeGeneral controlled list" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="specific_type" nullable="true" remarks="More specific than general_type" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="doi" nullable="true" remarks="DOI of the record assigned by Datacite." size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="0" digits="0" id="7" name="days_until_release" nullable="false" remarks="Indicate how many days after doi_status is changed to Findable the resource is publicly available." size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="8" name="doi_issued_date" nullable="true" remarks="The date that the doi is assigned by datacite." size="13" type="date" typeCode="91"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="9" name="doi_status" nullable="true" remarks="Allowed value:Draft,Findable" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="'Accepted'::text" digits="0" id="10" name="process_status" nullable="false" remarks="Indicate the lifecycle stage of the record in ADA system" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="11" name="created_at" nullable="false" remarks="The date that the row was inserted" size="29" type="timestamp" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="12" name="updated_at" nullable="false" remarks="The date that the row was updated" size="29" type="timestamp" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="records_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="idx_records_doi" unique="false">
            <column ascending="true" name="doi"/>
         </index>
         <index name="records_title_key" unique="true">
            <column ascending="true" name="title"/>
         </index>
         <checkConstraint constraint="((doi_status = ANY (ARRAY['Draft'::text, 'Findable'::text])))" name="records_doi_status_check"/>
         <checkConstraint constraint="((general_type = ANY (ARRAY['Collection'::text, 'Dataset'::text, 'Event'::text, 'Image'::text, 'InteractiveResource'::text, 'Model'::text, 'PhysicalObject'::text, 'Service'::text, 'Software'::text, 'text'::text, 'Workflow'::text, 'Other'::text])))" name="records_general_type_check"/>
         <checkConstraint constraint="((process_status = ANY (ARRAY['Accepted'::text, 'Submitted'::text, 'InReview'::text, 'Published'::text, 'Rejected'::text, 'Archived'::text])))" name="records_process_status_check"/>
         <checkConstraint constraint="((submission_type = ANY (ARRAY['Regular'::text, 'BundleDelivery'::text])))" name="records_submission_type_check"/>
      </table>
      <table name="subject_schemas" remarks="Table holding json schemas of different subject(object) approved by ADA system, e.g. analysis object, sample object" schema="public" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('subject_schemes_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4">
            <child column="subject_schema_id" foreignKey="record_subjects_subject_scheme_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="record_subjects"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="name" nullable="false" remarks="datacite:subjectScheme" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="json_schema" nullable="false" remarks="" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="description" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="4" name="created_at" nullable="false" remarks="Indicate when the subject scheme was created" size="29" type="timestamp" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="5" name="updated_at" nullable="false" remarks="Indicate when the subject scheme was last updated" size="29" type="timestamp" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="subject_scheme_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="subject_scheme_subject_scheme_name_key" unique="true">
            <column ascending="true" name="name"/>
         </index>
      </table>
      <table name="v_name_entities" numRows="0" remarks="" schema="public" type="VIEW" viewSql=" SELECT ne.id,&#10;    ne.full_name,&#10;    ne.name_type,&#10;    ne.family_name,&#10;    ne.given_name,&#10;    eis.name AS identifier_type,&#10;    nei.identifier&#10;   FROM ((name_entities ne&#10;     JOIN name_entity_identifiers nei ON ((nei.name_entity_id = ne.id)))&#10;     JOIN external_identifier_schemes eis ON ((nei.external_identifier_scheme_id = eis.id)));">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="id" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="full_name" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="name_type" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="family_name" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="given_name" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="identifier_type" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="identifier" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
      </table>
      <table name="view_datacite_contributors" numRows="0" remarks="" schema="public" type="VIEW" viewSql=" SELECT rc.record_id,&#10;    rc.name_entity_id,&#10;    jsonb_build_object('contributorType', rc.contributor_type, 'name', f.full_name, 'nameType', f.name_type, 'nameIdentifiers',&#10;        CASE&#10;            WHEN (f.identifier IS NULL) THEN jsonb_build_array()&#10;            WHEN (f.name = ANY (ARRAY['ORCID'::text, 'ROR'::text])) THEN jsonb_build_array(jsonb_build_object('nameIdentifierScheme', f.name, 'nameIdentifier', f.identifier))&#10;            ELSE jsonb_build_array()&#10;        END) AS contributor&#10;   FROM (record_contributors rc&#10;     JOIN ( SELECT ne.id,&#10;            ne.full_name,&#10;            ne.name_type,&#10;            eis.name,&#10;            nei.identifier&#10;           FROM ((name_entities ne&#10;             LEFT JOIN name_entity_identifiers nei ON ((nei.name_entity_id = ne.id)))&#10;             LEFT JOIN external_identifier_schemes eis ON ((eis.id = nei.external_identifier_scheme_id)))) f ON ((f.id = rc.name_entity_id)))&#10;  ORDER BY rc.record_id, rc.name_entity_id;">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="record_id" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="name_entity_id" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="contributor" nullable="true" remarks="" size="2147483647" type="jsonb" typeCode="1111"/>
      </table>
      <table name="view_datacite_creators" numRows="0" remarks="" schema="public" type="VIEW" viewSql=" SELECT rc.record_id,&#10;    rc.name_entity_id,&#10;    jsonb_build_object('name', ne.full_name, 'nameType', ne.name_type, 'givenName', ne.given_name, 'familyName', ne.family_name, 'nameIdentifiers', jsonb_build_array(jsonb_build_object('nameIdentifierScheme', eis.name, 'nameIdentifier', nei.identifier))) AS creator&#10;   FROM (((record_creators rc&#10;     JOIN name_entities ne ON ((ne.id = rc.name_entity_id)))&#10;     JOIN name_entity_identifiers nei ON ((nei.name_entity_id = ne.id)))&#10;     JOIN external_identifier_schemes eis ON ((eis.id = nei.external_identifier_scheme_id)))&#10;  WHERE (eis.name = 'ORCID'::text)&#10;  ORDER BY rc.record_id, rc.name_entity_id;">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="record_id" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="name_entity_id" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="creator" nullable="true" remarks="" size="2147483647" type="jsonb" typeCode="1111"/>
      </table>
   </tables>
   <routines>
      <routine dataAccess="MODIFIES" deterministic="false" name="track_record_status_change()" returnType="trigger" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="PLPGSQL"><![CDATA[begin
	    IF (TG_OP = 'INSERT') then
	    	insert into record_trails (record_id, status,status_on) values(new.id,new.process_status,new.updated_at);
	    ELSIF (TG_OP = 'UPDATE') THEN
	        IF NEW.process_status <> old.process_status then
	        	insert into record_trails (record_id, status,status_on) values(new.id,new.process_status,new.updated_at);
	        END IF;
	    end if;
        return new;
    END;]]></definition>
         <parameters/>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="false" name="trigger_set_timestamp()" returnType="trigger" securityType="INVOKER" type="FUNCTION">
         <comment/>
         <definition language="PLPGSQL"><![CDATA[BEGIN
  NEW.updated_at = NOW();
  RETURN NEW;
END;]]></definition>
         <parameters/>
      </routine>
   </routines>
</database>
