<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.9.xsd">

  <changeSet id="0001" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="citizen" columnName="is_guardian"/>
      </not>
    </preConditions>

    <addColumn tableName="citizen">
      <column name="is_guardian" type="boolean" defaultValueBoolean="false" remarks="Признак опекунства">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="is_guardian"/>
    </rollback>
  </changeSet>

  <changeSet id="0002" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="citizen" columnName="minors_count"/>
      </not>
    </preConditions>

    <addColumn tableName="citizen">
      <column name="minors_count" type="int" defaultValue="0" remarks="Кол-во несовершеннолетних детей">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="minors_count"/>
    </rollback>
  </changeSet>

  <changeSet id="0003" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="citizen" columnName="has_dead_child"/>
      </not>
    </preConditions>

    <addColumn tableName="citizen">
      <column name="has_dead_child" type="boolean" defaultValueBoolean="false" remarks="Признак наличия умершего ребенка">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="has_dead_child"/>
    </rollback>
  </changeSet>

  <changeSet id="0004" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="citizen" columnName="has_minor_child"/>
      </not>
    </preConditions>

    <addColumn tableName="citizen">
      <column name="has_minor_child" type="boolean" defaultValueBoolean="false" remarks="Признак наличия несовершеннолетнего ребенка">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="has_minor_child"/>
    </rollback>
  </changeSet>

  <changeSet id="0005" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="citizen" columnName="has_russian_citizenship"/>
      </not>
    </preConditions>

    <addColumn tableName="citizen">
      <column name="has_russian_citizenship" type="boolean" defaultValueBoolean="false" remarks="Признак наличия российского гражданства">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="has_russian_citizenship"/>
    </rollback>
  </changeSet>

  <changeSet id="0006" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="citizen" columnName="has_foreign_citizenship"/>
      </not>
    </preConditions>

    <addColumn tableName="citizen">
      <column name="has_foreign_citizenship" type="boolean" defaultValueBoolean="false" remarks="Признак наличия иностранного гражданства">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="has_foreign_citizenship"/>
    </rollback>
  </changeSet>

  <changeSet id="0007" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="citizen" columnName="has_ground_transport"/>
      </not>
    </preConditions>

    <addColumn tableName="citizen">
      <column name="has_ground_transport" type="boolean" defaultValueBoolean="false" remarks="Признак наличия наземного транспорта">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="has_ground_transport"/>
    </rollback>
  </changeSet>

  <changeSet id="0008" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="citizen" columnName="has_air_transport"/>
      </not>
    </preConditions>

    <addColumn tableName="citizen">
      <column name="has_air_transport" type="boolean" defaultValueBoolean="false" remarks="Признак наличия воздушного транспорта">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="has_air_transport"/>
    </rollback>
  </changeSet>

  <changeSet id="0009" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="citizen" columnName="has_water_transport"/>
      </not>
    </preConditions>

    <addColumn tableName="citizen">
      <column name="has_water_transport" type="boolean" defaultValueBoolean="false" remarks="Признак наличия водного транспорта">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="has_water_transport"/>
    </rollback>
  </changeSet>

  <changeSet id="0010" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="citizen" columnName="has_property"/>
      </not>
    </preConditions>

    <addColumn tableName="citizen">
      <column name="has_property" type="boolean" defaultValueBoolean="false" remarks="Признак наличия недвижимости">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="has_property"/>
    </rollback>
  </changeSet>

  <changeSet id="0011" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="citizen" columnName="has_driver_license"/>
      </not>
    </preConditions>

    <addColumn tableName="citizen">
      <column name="has_driver_license" type="boolean" defaultValueBoolean="false" remarks="Признак наличия водительского удостоверения">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="has_driver_license"/>
    </rollback>
  </changeSet>

  <changeSet id="0012" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="citizen" columnName="is_deputy"/>
      </not>
    </preConditions>

    <addColumn tableName="citizen">
      <column name="is_deputy" type="boolean" defaultValueBoolean="false" remarks="Признак статуса депутата">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="is_deputy"/>
    </rollback>
  </changeSet>

  <changeSet id="0013" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="citizen" columnName="is_deputy_candidate"/>
      </not>
    </preConditions>

    <addColumn tableName="citizen">
      <column name="is_deputy_candidate" type="boolean" defaultValueBoolean="false" remarks="Признак статуса кандидата на выборах в депутаты">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="is_deputy_candidate"/>
    </rollback>
  </changeSet>

  <changeSet id="0014" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="citizen" columnName="has_tractor_license"/>
      </not>
    </preConditions>

    <addColumn tableName="citizen">
      <column name="has_tractor_license" type="boolean" defaultValueBoolean="false" remarks="Признак наличия удостоверения водителя трактора">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="has_tractor_license"/>
    </rollback>
  </changeSet>

  <changeSet id="0015" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="citizen" columnName="has_criminal_prosecution"/>
      </not>
    </preConditions>

    <addColumn tableName="citizen">
      <column name="has_criminal_prosecution" type="boolean" defaultValueBoolean="false" remarks="Признак наличия уголовного преследования">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="has_criminal_prosecution"/>
    </rollback>
  </changeSet>

  <changeSet id="0016" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="citizen" columnName="has_sentence"/>
      </not>
    </preConditions>

    <addColumn tableName="citizen">
      <column name="has_sentence" type="boolean" defaultValueBoolean="false" remarks="Признак наличия вынесенного приговора">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="has_sentence"/>
    </rollback>
  </changeSet>

  <changeSet id="0017" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="citizen" columnName="serving_sentence"/>
      </not>
    </preConditions>

    <addColumn tableName="citizen">
      <column name="serving_sentence" type="boolean" defaultValueBoolean="false" remarks="Признак отбывания наказания">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="serving_sentence"/>
    </rollback>
  </changeSet>

  <changeSet id="0018" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="citizen" columnName="has_criminal_record"/>
      </not>
    </preConditions>

    <addColumn tableName="citizen">
      <column name="has_criminal_record" type="boolean" defaultValueBoolean="false" remarks="Признак наличия судимости">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="has_criminal_record"/>
    </rollback>
  </changeSet>

  <changeSet id="0019" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="citizen" columnName="has_sent_summons"/>
      </not>
    </preConditions>

    <addColumn tableName="citizen">
      <column name="has_sent_summons" type="boolean" defaultValueBoolean="false" remarks="Признак наличия направленной повестки">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="has_sent_summons"/>
    </rollback>
  </changeSet>

  <changeSet id="0020" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="citizen" columnName="has_served_summons"/>
      </not>
    </preConditions>

    <addColumn tableName="citizen">
      <column name="has_served_summons" type="boolean" defaultValueBoolean="false" remarks="Признак наличия врученной повестки">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="has_served_summons"/>
    </rollback>
  </changeSet>

  <changeSet id="0021" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="citizen" columnName="appeared_to_recruitment_center"/>
      </not>
    </preConditions>

    <addColumn tableName="citizen">
      <column name="appeared_to_recruitment_center" type="boolean" defaultValueBoolean="false" remarks="Признак явки в военный комиссариат">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="appeared_to_recruitment_center"/>
    </rollback>
  </changeSet>

  <changeSet id="0022" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="citizen" columnName="not_appeared_by_valid_excuse"/>
      </not>
    </preConditions>

    <addColumn tableName="citizen">
      <column name="not_appeared_by_valid_excuse" type="boolean" defaultValueBoolean="false" remarks="Признак неявки в военкомат по уважительной причине">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="not_appeared_by_valid_excuse"/>
    </rollback>
  </changeSet>

  <changeSet id="0023" author="AlexSave">
    <preConditions onFail="MARK_RAN">
      <not>
        <columnExists tableName="citizen" columnName="has_active_temporary_measure"/>
      </not>
    </preConditions>

    <addColumn tableName="citizen">
      <column name="has_active_temporary_measure" type="boolean" defaultValueBoolean="false" remarks="Признак наличия примененных временных мер">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <rollback>
      <dropColumn tableName="citizen" columnName="has_active_temporary_measure"/>
    </rollback>
  </changeSet>
</databaseChangeLog>
