<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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-2.0.xsd"
  logicalFilePath="db-changelog-000072-test-data.xml">

  <changeSet author="appian" id="tag-000071">
    <tagDatabase tag="000071"/>
  </changeSet>
  
  <changeSet author="appian" id="000072.1.0">
    <comment>Add TestDataStorage table for storing arbitrary test data</comment>
    <createTable tableName="test_data">
      <column name="id" type="${longType}" autoIncrement="${autoIncrement}">
        <constraints nullable="false" primaryKey="true"/>
      </column>
      <column name="uuid" type="${uuidType}">
        <constraints nullable="false"/>
      </column>
      
      <column name="obj_type" type="${shortStringType}">
        <constraints nullable="false"/>
      </column>
      <column name="obj_uuid" type="${uuidType}">
        <constraints nullable="false"/>
      </column>
      <column name="obj_version_id" type="${longType}">
        <constraints nullable="false"/>
      </column>
      
      <column name="data_type" type="${shortStringType}">
        <constraints nullable="false"/>
      </column>
      <column name="data" type="${largeStringType}">
        <constraints nullable="false"/>
      </column>
    </createTable>
  </changeSet>
  
  <changeSet author="appian" id="000072.2.0">
    <preConditions onFail="MARK_RAN">
      <changeLogPropertyDefined property="createSequence" value="true"/>
    </preConditions>
    <createSequence sequenceName="test_data_sq"/>
  </changeSet>
  
  <changeSet author="appian" id="000072.3.0">    
    <comment>Add unique constraint for design object type, id and uuid</comment>
    <addUniqueConstraint columnNames="obj_uuid, obj_version_id, obj_type"
          tableName="test_data"/>
  </changeSet>
</databaseChangeLog>