<?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="hairuulin.b" dbms="postgresql">
    <comment>CREATE TABLE ervu_dashboard.citizen_work_activity</comment>
    <sql>
    CREATE TABLE IF NOT EXISTS ervu_dashboard.citizen_work_activity
		(
		citizen_work_activity_id bigserial,
		place_work character varying COLLATE pg_catalog."default",
		employer_category character varying COLLATE pg_catalog."default",
		organization_name character varying COLLATE pg_catalog."default",
		inn character varying COLLATE pg_catalog."default",
		recruit_id uuid NOT NULL,
		ogrn character varying COLLATE pg_catalog."default",
		kpp character varying COLLATE pg_catalog."default",
		organization_address character varying COLLATE pg_catalog."default",
		employer_status character varying COLLATE pg_catalog."default",
		type_separate_division character varying COLLATE pg_catalog."default",
		address_separate_division character varying COLLATE pg_catalog."default",
		type_hr_event character varying COLLATE pg_catalog."default",
		date_hr_event date,
		job_title character varying COLLATE pg_catalog."default",
		info_parental_leave character varying COLLATE pg_catalog."default",
		start_date_parental_leave date,
		end_date_parental_leave date,
		ogrn_ip character varying COLLATE pg_catalog."default",
		date_reg_ip date,
		date_dereg_ip date,
		date_term_reg_ip date,
		date_reg_self date,
		date_dereg_self date,
		info_separator_didvision character varying COLLATE pg_catalog."default",
		CONSTRAINT citizen_work_activity_pkey PRIMARY KEY (citizen_work_activity_id)
		)
		TABLESPACE pg_default;
		ALTER TABLE IF EXISTS ervu_dashboard.citizen_work_activity
		OWNER to "ervu-dashboard";
		COMMENT ON TABLE ervu_dashboard.citizen_work_activity
		IS 'Сведения о трудовой деятельности';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.place_work
		IS 'Место работы';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.employer_category
		IS 'Категория работодателя';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.organization_name
		IS 'Наименование организации';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.inn
		IS 'ИНН / ИНН ФЛ';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.recruit_id
		IS 'ссылка на гражданина (citizen)';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.ogrn
		IS 'ОГРН / ОГРНИП';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.kpp
		IS 'КПП';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.organization_address
		IS 'Адрес организации';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.employer_status
		IS 'Статус работодателя';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.type_separate_division
		IS 'Тип обособленного подразделения работодателя';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.address_separate_division
		IS 'Адрес обособленного структурного подразделения работодателя';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.type_hr_event
		IS 'Тип кадрового мероприятия ';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.date_hr_event
		IS 'Дата кадрового мероприятия';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.job_title
		IS 'Должность';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.info_parental_leave
		IS 'Сведения о нахождении в отпуске по уходу за ребенком';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.start_date_parental_leave
		IS 'Дата начала отпуска по уходу за ребенком';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.end_date_parental_leave
		IS 'Дата окончания отпуска по уходу за ребенком';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.ogrn_ip
		IS 'ОГРНИП (ИП)';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.date_reg_ip
		IS 'Дата регистрации в качестве ИП';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.date_dereg_ip
		IS 'Дата снятия с учета в качестве ИП';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.date_term_reg_ip
		IS 'Дата прекращения регистрации в качестве ИП';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.date_reg_self
		IS 'Дата постановки на учет (Самозанятый)';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.date_dereg_self
		IS 'Дата снятия с учета (Самозанятый)';
		COMMENT ON COLUMN ervu_dashboard.citizen_work_activity.info_separator_didvision
		IS 'Сведения о работе гражданина в обособленном подразделении работодателя';
    </sql>
  </changeSet>
  
  <changeSet id="0002" author="hairuulin.b" dbms="postgresql">
    <comment>add new table public.action_logs</comment>
   <sql>
    CREATE TABLE IF NOT EXISTS ervu_dashboard.citizen_education_diplomas_received
		(
		citizen_education_diplomas_received_id bigserial,
		type_organization character varying COLLATE pg_catalog."default",
		name_edu_organization character varying COLLATE pg_catalog."default",
		inn character varying COLLATE pg_catalog."default",
		ogrn character varying COLLATE pg_catalog."default",
		kpp character varying COLLATE pg_catalog."default",
		address_edu_organization character varying COLLATE pg_catalog."default",
		status_organization character varying COLLATE pg_catalog."default",
		type_separate_division character varying COLLATE pg_catalog."default",
		address_separate_division character varying COLLATE pg_catalog."default",
		student_status character varying COLLATE pg_catalog."default",
		education_level_student character varying COLLATE pg_catalog."default",
		course_training character varying COLLATE pg_catalog."default",
		education_program_code character varying COLLATE pg_catalog."default",
		name_education_program character varying COLLATE pg_catalog."default",
		form_study character varying COLLATE pg_catalog."default",
		receiving_education_first_time character varying COLLATE pg_catalog."default",
		obtaining_vus character varying COLLATE pg_catalog."default",
		code_profession character varying COLLATE pg_catalog."default",
		name_profession character varying COLLATE pg_catalog."default",
		education_level_org character varying COLLATE pg_catalog."default",
		start_date_edu date,
		receipt_date date,
		planned_graduation_date date,
		order_number character varying COLLATE pg_catalog."default",
		order_date date,
		date_deduction date,
		order_number_deduction character varying COLLATE pg_catalog."default",
		order_date_deduction character varying COLLATE pg_catalog."default",
		completion_date date,
		restore_date date,
		order_number_restore character varying COLLATE pg_catalog."default",
		order_date_restore character varying COLLATE pg_catalog."default",
		start_date_training_cur_specialty date,
		women_obtaining_profession character varying COLLATE pg_catalog."default",
		academic_leave character varying COLLATE pg_catalog."default",
		start_date_academic date,
		end_date_academic date,
		maternity_leave character varying COLLATE pg_catalog."default",
		start_date_maternity date,
		end_date_maternity date,
		start_date_military_center date,
		end_date_military_center date,
		start_date_mil_department date,
		end_date_mil_department date,
		successful_mil_dep character varying COLLATE pg_catalog."default",
		rus_doc_education character varying COLLATE pg_catalog."default",
		education_level_doc_rus character varying COLLATE pg_catalog."default",
		doc_type_rus character varying COLLATE pg_catalog."default",
		series_doc_rus character varying COLLATE pg_catalog."default",
		number_doc_rus character varying COLLATE pg_catalog."default",
		reg_number_doc_rus character varying COLLATE pg_catalog."default",
		date_issue_doc_rus date,
		name_edu_org_doc_rus character varying COLLATE pg_catalog."default",
		code_spec_doc_rus character varying COLLATE pg_catalog."default",
		name_spec_doc_rus character varying COLLATE pg_catalog."default",
		info_vus_doc_rus character varying COLLATE pg_catalog."default",
		foreign_doc_education character varying COLLATE pg_catalog."default",
		education_level_foreign_doc character varying COLLATE pg_catalog."default",
		name_edu_org_doc_foreign character varying COLLATE pg_catalog."default",
		name_doc_foreign character varying COLLATE pg_catalog."default",
		series_number_doc_foreign character varying COLLATE pg_catalog."default",
		reg_number_doc_foreign character varying COLLATE pg_catalog."default",
		number_cert_doc_foreign character varying COLLATE pg_catalog."default",
		date_doc_foreign date,
		code_spec_doc_foreign character varying COLLATE pg_catalog."default",
		name_spec_doc_foreign character varying COLLATE pg_catalog."default",
		name_country_doc_foreign character varying COLLATE pg_catalog."default",
		obtaining_vus_doc_foreign character varying COLLATE pg_catalog."default",
		recruit_id uuid NOT NULL,
		CONSTRAINT citizen_education_diplomas_received_pkey PRIMARY KEY (citizen_education_diplomas_received_id)
		)
		TABLESPACE pg_default;
		ALTER TABLE IF EXISTS ervu_dashboard.citizen_education_diplomas_received
		OWNER to "ervu-dashboard";
		COMMENT ON TABLE ervu_dashboard.citizen_education_diplomas_received
		IS 'Сведения об образовании и полученных дипломах';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.type_organization
		IS 'Тип организации';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.name_edu_organization
		IS 'Наименование образовательной организации';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.inn
		IS 'ИНН';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.ogrn
		IS 'ОГРН / ОГРНИП';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.kpp
		IS 'КПП';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.address_edu_organization
		IS 'Адрес образовательной организации';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.status_organization
		IS 'Статус организации';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.type_separate_division
		IS 'Вид обособленного подразделения образовательной организации';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.address_separate_division
		IS 'Адрес обособленного подразделения образовательной организации';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.student_status
		IS 'Статус обучающегося';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.education_level_student
		IS 'Уровень образования (студент)';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.course_training
		IS 'Курс (класс) обучения';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.education_program_code
		IS 'Код образовательной программы';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.name_education_program
		IS 'Наименование образовательной программы';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.form_study
		IS 'Форма обучения';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.receiving_education_first_time
		IS 'Сведения о получении образования впервые';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.obtaining_vus
		IS 'Сведения о получении ВУС';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.code_profession
		IS 'Код профессии, специальности, направления подготовки';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.name_profession
		IS 'Наименование профессии, специальности, направления подготовки';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.education_level_org
		IS 'Уровень образования';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.start_date_edu
		IS 'Дата начала обучения';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.receipt_date
		IS 'Дата поступления';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.planned_graduation_date
		IS 'Плановая дата окончания обучения';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.order_number
		IS 'Номер приказа о зачислении';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.order_date
		IS 'Дата приказа о зачислении';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.date_deduction
		IS 'Дата отчисления';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.order_number_deduction
		IS 'Номер приказа об отчислении';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.order_date_deduction
		IS 'Дата приказа об отчислении';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.completion_date
		IS 'Дата завершения обучения';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.restore_date
		IS 'Дата восстановления';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.order_number_restore
		IS 'Номер приказа о восстановлении';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.order_date_restore
		IS 'Дата приказа о восстановлении';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.start_date_training_cur_specialty
		IS 'Дата начала обучения по текущей специальности';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.women_obtaining_profession
		IS 'Сведения о получении профессии, специальности, при наличии которых граждане женского поля получают военно-учётные специальности и подлежат постановке на воинский учет (для граждан женского пола)';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.academic_leave
		IS 'Наличие академического отпуска';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.start_date_academic
		IS 'Дата начала академического отпуска';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.end_date_academic
		IS 'Дата окончания академического отпуска';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.maternity_leave
		IS 'Наличие отпуска по уходу за ребёнком';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.start_date_maternity
		IS 'Дата начала отпуска по уходу за ребенком';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.end_date_maternity
		IS 'Дата окончания отпуска по уходу за ребенком';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.start_date_military_center
		IS 'Дата начала обучения в военнно-учебном центре';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.end_date_military_center
		IS 'Дата окончания обучения в военнно-учебном центре ';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.start_date_mil_department
		IS 'Дата начала обучения на военной кафедре';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.end_date_mil_department
		IS 'Дата окончания обучения на военной кафедре';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.successful_mil_dep
		IS 'Сведения об успешном завершении обучения на военных кафедрах';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.rus_doc_education
		IS 'Сведения о наличии российского документа об образовании и (или) квалификации';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.education_level_doc_rus
		IS 'Уровень образования (Российские дипломы)';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.doc_type_rus
		IS 'Вид документа';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.series_doc_rus
		IS 'Серия';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.number_doc_rus
		IS 'Номер';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.reg_number_doc_rus
		IS 'Регистрационный номер';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.date_issue_doc_rus
		IS 'Дата выдачи';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.name_edu_org_doc_rus
		IS 'Наименование образовательной организации';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.code_spec_doc_rus
		IS 'Код специальности, направления подготовки';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.name_spec_doc_rus
		IS 'Наименование специальности, направления подготовки';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.info_vus_doc_rus
		IS 'Сведения о получении ВУС';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.foreign_doc_education
		IS 'Сведения о наличии иностранного документа об образовании и (или) квалификации';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.education_level_foreign_doc
		IS 'Уровень образования (Иностранные дипломы)';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.name_edu_org_doc_foreign
		IS 'Наименование образовательной организации';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.name_doc_foreign
		IS 'Наименование иностранного документа';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.series_number_doc_foreign
		IS 'Серия и номер';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.reg_number_doc_foreign
		IS 'Регистрационный номер';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.number_cert_doc_foreign
		IS 'Номер свидетельства о признании документа';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.date_doc_foreign
		IS 'Дата признания документа';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.code_spec_doc_foreign
		IS 'Код признанной специальности, направления подготовки';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.name_spec_doc_foreign
		IS 'Наименование признанной специальности, направления подготовки';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.name_country_doc_foreign
		IS 'Наименование страны, выдавшей документ';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.obtaining_vus_doc_foreign
		IS 'Сведения о получении ВУС';
		COMMENT ON COLUMN ervu_dashboard.citizen_education_diplomas_received.recruit_id
		IS 'ссылка на гражданина (citizen)';
   </sql>   
  </changeSet>
  
    <changeSet id="0003" author="hairuulin.b" dbms="postgresql">
    <comment>ALTER TABLE ervu_dashboard.citizen</comment>
    <sql>
	ALTER TABLE IF EXISTS ervu_dashboard.citizen
	ADD COLUMN IF NOT EXISTS start_date_residence date,
	ADD COLUMN IF NOT EXISTS end_date_residence date,
	ADD COLUMN IF NOT EXISTS address_place_stay character varying,
	ADD COLUMN IF NOT EXISTS start_date_place_stay date,
	ADD COLUMN IF NOT EXISTS end_date_place_stay date,
	ADD COLUMN IF NOT EXISTS type_place_stay character varying,
	ADD COLUMN IF NOT EXISTS address_actual character varying,
	ADD COLUMN IF NOT EXISTS source_info_actual character varying,
	ADD COLUMN IF NOT EXISTS date_info_actual date,
	ADD COLUMN IF NOT EXISTS date_loss_info_actual date;
	COMMENT ON COLUMN ervu_dashboard.citizen.start_date_residence
    IS 'Дата регистрации по месту жительства';
	COMMENT ON COLUMN ervu_dashboard.citizen.end_date_residence
		IS 'Дата снятия с регистрации по месту жительства';
	COMMENT ON COLUMN ervu_dashboard.citizen.address_place_stay
		IS 'Адрес регистрации по месту пребыванния';
	COMMENT ON COLUMN ervu_dashboard.citizen.start_date_place_stay
		IS 'Дата регистрации по месту пребывания';
	COMMENT ON COLUMN ervu_dashboard.citizen.end_date_place_stay
		IS 'Дата снятия с регистрации по месту пребывания';
	COMMENT ON COLUMN ervu_dashboard.citizen.type_place_stay
		IS 'Тип регистрации';
	COMMENT ON COLUMN ervu_dashboard.citizen.address_actual
		IS 'Адрес фактического проживания';
	COMMENT ON COLUMN ervu_dashboard.citizen.source_info_actual
		IS 'Источник сведений о месте фактического проживания';
	COMMENT ON COLUMN ervu_dashboard.citizen.date_info_actual
		IS 'Дата получения сведений об адресе фактического проживания';
	COMMENT ON COLUMN ervu_dashboard.citizen.date_loss_info_actual
		IS 'Дата потери актуальности сведений об адресе фактического проживания';
	</sql>   
  </changeSet>
</databaseChangeLog>
