<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9
                      http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd">
					  
	<changeSet id="0001" author="saliakhov">
        <comment>create schema</comment>
		<sql>
			CREATE SCHEMA IF NOT EXISTS forecast;
			ALTER SCHEMA forecast OWNER TO "ervu-dashboard";
		</sql>
	</changeSet>
	
	<changeSet id="0002" author="saliakhov">
        <comment>create table</comment>
		<sql>
			CREATE TABLE IF NOT EXISTS forecast.registered_citizens (
				registered_citizens_id bigserial NOT NULL,
				recruitment_id uuid NOT NULL,
				recording_date date DEFAULT now() NOT NULL,
				"schema" varchar(64) DEFAULT 'empty'::character varying NOT NULL,
				count_all numeric NULL,
				reaching_17_age numeric NULL,
				women_military_specialty numeric NULL,
				CONSTRAINT pk_registered_citizens PRIMARY KEY (registered_citizens_id)
			);

			ALTER TABLE IF EXISTS forecast.registered_citizens OWNER TO "ervu-dashboard";	

				
			COMMENT ON TABLE forecast.registered_citizens IS 'Динамика количества граждан на учете';
			COMMENT ON COLUMN forecast.registered_citizens.count_all IS 'Всего на учете';
			COMMENT ON COLUMN forecast.registered_citizens.reaching_17_age IS 'В год достижения 17 лет'; 
			COMMENT ON COLUMN forecast.registered_citizens.women_military_specialty IS 'Женщины, получившие ВУС';
		</sql>
	</changeSet>
</databaseChangeLog>