<?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-4.27.xsd">

  <changeSet id="0007-1-add-version-to-dictionary-definitions" author="ordinis">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="dictionary_definitions" columnName="version"/>
      </not>
    </preConditions>
    <comment>Add @Version column for JPA optimistic locking on dictionary_definitions</comment>
    <addColumn tableName="dictionary_definitions">
      <column name="version" type="BIGINT" defaultValueNumeric="0">
        <constraints nullable="false"/>
      </column>
    </addColumn>
  </changeSet>

  <changeSet id="0007-2-add-version-to-dictionary-records" author="ordinis">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="dictionary_records" columnName="version"/>
      </not>
    </preConditions>
    <comment>Add @Version column for JPA optimistic locking on dictionary_records</comment>
    <addColumn tableName="dictionary_records">
      <column name="version" type="BIGINT" defaultValueNumeric="0">
        <constraints nullable="false"/>
      </column>
    </addColumn>
  </changeSet>

</databaseChangeLog>
