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

  <changeSet id="0001" author="ya.kuznetsova" dbms="postgresql">
    <comment>add new table ervu_dashboard.delta</comment>
    <sql>
      CREATE TABLE IF NOT EXISTS ervu_dashboard.delta
      (
      delta_id bigserial,
      value timestamp without time zone,
      CONSTRAINT pk_delta PRIMARY KEY (delta_id)
      );

      ALTER TABLE IF EXISTS ervu_dashboard.delta
      OWNER to "ervu-dashboard";

      COMMENT ON TABLE ervu_dashboard.delta
      IS 'таблица с параметром, на основе которого загружается дельта по гражданам';

      COMMENT ON COLUMN ervu_dashboard.delta.value
      IS 'дата, от которой необходимо грузить данные';
    </sql>
  </changeSet>
  
  <changeSet id="0002" author="ya.kuznetsova" dbms="postgresql">
    <comment>add column to citizen</comment>
    <addColumn tableName="citizen" schemaName="ervu_dashboard">
      <column name="update_date" type="timestamp without time zone" remarks="Дата обновления"/>
    </addColumn>
  </changeSet>
</databaseChangeLog>
