<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
    http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.19.xsd">

  <property name="schema.name" value="ervu_dashboard"/>

  <changeSet id="0001" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <tableExists tableName="citizen" schemaName="${schema.name}"/>
      <not>
        <columnExists tableName="citizen" columnName="having_sport_title" schemaName="${schema.name}"/>
      </not>
    </preConditions>

    <comment>add citizen.having_sport_title</comment>

    <addColumn tableName="citizen" schemaName="${schema.name}">
      <column name="having_sport_title"
              type="boolean"
              defaultValueBoolean="false"
              remarks="Признак наличия спортивного звания (true - есть звание, false - нет)">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="having_sport_title" schemaName="${schema.name}"/>
    </rollback>
  </changeSet>
</databaseChangeLog>