liquibase.plugincoremodel.tableObservations.xml Maven / Gradle / Ivy
<?xml version="1.0" encoding="UTF-8"?> <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd"> <!-- Copyright (C) 2024 Fraunhofer Institut IOSB, Fraunhoferstr. 1, D 76131 Karlsruhe, Germany. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. --> <changeSet author="scf" id="2021-01-01-observations-1" objectQuotingStrategy="QUOTE_ALL_OBJECTS"> <preConditions onFail="MARK_RAN"> <not> <tableExists tableName="OBSERVATIONS" /> </not> </preConditions> <createTable tableName="OBSERVATIONS"> <column name="PHENOMENON_TIME_START" type="TIMESTAMP WITH TIME ZONE"/> <column name="PHENOMENON_TIME_END" type="TIMESTAMP WITH TIME ZONE"/> <column name="RESULT_TIME" type="TIMESTAMP WITH TIME ZONE"/> <column name="RESULT_TYPE" type="TINYINT"/> <column name="RESULT_NUMBER" type="FLOAT8"/> <column name="RESULT_BOOLEAN" type="BOOLEAN"/> <column name="RESULT_JSON" type="JSONB"/> <column name="RESULT_STRING" type="TEXT"/> <column name="RESULT_QUALITY" type="JSONB"/> <column name="VALID_TIME_START" type="TIMESTAMP WITH TIME ZONE"/> <column name="VALID_TIME_END" type="TIMESTAMP WITH TIME ZONE"/> <column name="PARAMETERS" type="JSONB"/> <column name="DATASTREAM_ID" type="${idType-Datastream}"> <constraints nullable="false"/> </column> <column name="FEATURE_ID" type="${idType-Feature}"> <constraints nullable="false"/> </column> </createTable> </changeSet> <changeSet author="scf" id="2021-01-01-observations-2" objectQuotingStrategy="QUOTE_ALL_OBJECTS"> <validCheckSum>8:ea53f31fb995c9298e6e63a91247e2b3</validCheckSum> <preConditions onFail="MARK_RAN"> <changeLogPropertyDefined property="id-Observation" value="LONG" /> <not> <columnExists columnName="ID" tableName="OBSERVATIONS" /> </not> </preConditions> <addColumn tableName="OBSERVATIONS"> <column name="ID" type="${idTypeLong}" autoIncrement="true"> <constraints primaryKey="true" primaryKeyName="OBSERVATIONS_PKEY" /> </column> </addColumn> </changeSet> <changeSet author="scf" id="2021-01-01-observations-3" objectQuotingStrategy="QUOTE_ALL_OBJECTS"> <validCheckSum>8:353b4d5d13905e59100c7228e262eef6</validCheckSum> <preConditions onFail="MARK_RAN"> <or> <changeLogPropertyDefined property="id-Observation" value="STRING" /> <changeLogPropertyDefined property="id-Observation" value="UUID" /> </or> <not> <columnExists columnName="ID" tableName="OBSERVATIONS" /> </not> </preConditions> <addColumn tableName="OBSERVATIONS"> <column name="ID" type="${idType-Observation}" defaultValueComputed="${defaultValueComputed-Observation}"> <constraints primaryKey="true" primaryKeyName="OBSERVATIONS_PKEY"/> </column> </addColumn> </changeSet> <changeSet author="scf" id="2021-01-01-observations-4" objectQuotingStrategy="QUOTE_ALL_OBJECTS"> <preConditions onFail="MARK_RAN"> <not> <indexExists tableName="OBSERVATIONS" indexName="OBSERVATIONS_DATASTREAM_ID" /> </not> </preConditions> <createIndex tableName="OBSERVATIONS" indexName="OBSERVATIONS_DATASTREAM_ID"> <column name="DATASTREAM_ID" /> </createIndex> <createIndex tableName="OBSERVATIONS" indexName="OBSERVATIONS_FEATURE_ID"> <column name="FEATURE_ID" /> </createIndex> </changeSet> </databaseChangeLog>