diff --git a/db/.gitignore b/db/.gitignore new file mode 100644 index 0000000..c463a00 --- /dev/null +++ b/db/.gitignore @@ -0,0 +1,22 @@ +#ignore target dir +target*/ + +*.orig + +# +# IntelliJ IDEA project files +# +.idea*/ +.classes*/ +*.ipr +*.iml +*.iws +*.ids +atlassian-ide-plugin.xml + + +# os meta files +Thumbs.db +.DS_Store + +pom.xml.versionsBackup \ No newline at end of file diff --git a/db/pom.xml b/db/pom.xml new file mode 100644 index 0000000..a69bb3d --- /dev/null +++ b/db/pom.xml @@ -0,0 +1,56 @@ + + + 4.0.0 + + ru.micord.ervu + business-metrics + 1.8.0 + + + ru.micord.ervu.business-metrics + db + + + true + + + + + + + org.liquibase + liquibase-maven-plugin + 4.15.0 + + ${liquibase.skip} + src/main/resources/properties/${liquibase.propertyFileName}.properties + true + true + UTF-8 + + + + org.postgresql + postgresql + 42.3.6 + + + + + + + + + + + + ervu_business_metrics + + false + ervu_business_metrics + + + + + + diff --git a/db/src/README b/db/src/README new file mode 100644 index 0000000..27f57b5 --- /dev/null +++ b/db/src/README @@ -0,0 +1,2 @@ +Обязательно прочесть информацию по добавлению changeset-ов: +http://confluence.asd.center.cg/pages/viewpage.action?pageId=32931937 diff --git a/db/src/main/resources/changelog/changelog-master.xml b/db/src/main/resources/changelog/changelog-master.xml new file mode 100644 index 0000000..1f70cc1 --- /dev/null +++ b/db/src/main/resources/changelog/changelog-master.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/db/src/main/resources/changelog/v_0.1/20241031-ERVU-168_create_db.xml b/db/src/main/resources/changelog/v_0.1/20241031-ERVU-168_create_db.xml new file mode 100644 index 0000000..5531157 --- /dev/null +++ b/db/src/main/resources/changelog/v_0.1/20241031-ERVU-168_create_db.xml @@ -0,0 +1,437 @@ + + + + + create SCHEMA + + CREATE SCHEMA IF NOT EXISTS metrics; + ALTER SCHEMA metrics OWNER TO ervu_business_metrics; + + + + + create EXTENSION uuid-ossp + + CREATE EXTENSION IF NOT EXISTS "uuid-ossp" SCHEMA metrics; + + + + + add table recruitment + + CREATE TABLE IF NOT EXISTS metrics.recruitment + ( + id uuid NOT NULL DEFAULT metrics.uuid_generate_v4(), + idm_id character varying(256) COLLATE pg_catalog."default", + parent_id character varying COLLATE pg_catalog."default", + version integer, + created_at timestamp without time zone NOT NULL DEFAULT now(), + updated_at timestamp without time zone NOT NULL DEFAULT now(), + schema character varying(64) COLLATE pg_catalog."default" NOT NULL, + military_code character varying(16) COLLATE pg_catalog."default", + shortname character varying COLLATE pg_catalog."default" NOT NULL, + fullname character varying COLLATE pg_catalog."default" NOT NULL, + dns character varying(64) COLLATE pg_catalog."default", + email character varying(255) COLLATE pg_catalog."default", + phone character varying(24) COLLATE pg_catalog."default", + address character varying COLLATE pg_catalog."default", + address_id character varying COLLATE pg_catalog."default", + postal_address character varying COLLATE pg_catalog."default", + postal_address_id character varying COLLATE pg_catalog."default", + nsi_department_id character varying COLLATE pg_catalog."default", + nsi_organization_id character varying COLLATE pg_catalog."default", + oktmo character varying COLLATE pg_catalog."default", + org_ogrn character varying COLLATE pg_catalog."default", + dep_ogrn character varying COLLATE pg_catalog."default", + epgu_id character varying COLLATE pg_catalog."default", + kpp character varying(64) COLLATE pg_catalog."default", + inn character varying(64) COLLATE pg_catalog."default", + okato character varying(64) COLLATE pg_catalog."default", + division_type character varying(64) COLLATE pg_catalog."default", + tns_department_id character varying COLLATE pg_catalog."default", + enabled boolean NOT NULL DEFAULT true, + timezone character varying(64) COLLATE pg_catalog."default", + reports_enabled boolean, + region_id character varying COLLATE pg_catalog."default", + subpoena_series_code character varying(64) COLLATE pg_catalog."default", + hidden boolean NOT NULL DEFAULT false, + region_code text COLLATE pg_catalog."default", + ts timestamp without time zone NOT NULL DEFAULT now(), + CONSTRAINT recruitment_pkey PRIMARY KEY (id), + CONSTRAINT recruitment_idm_id_key UNIQUE (idm_id) + ) + WITH (OIDS = FALSE); + ALTER TABLE IF EXISTS metrics.recruitment OWNER to ervu_business_metrics; + + COMMENT ON TABLE metrics.recruitment IS 'Военный комиссариат'; + COMMENT ON COLUMN metrics.recruitment.id IS 'Идентификатор ВК'; + COMMENT ON COLUMN metrics.recruitment.idm_id IS 'Идентификатор организации'; + COMMENT ON COLUMN metrics.recruitment.parent_id IS 'Идентификатор вышестоящей организации'; + COMMENT ON COLUMN metrics.recruitment.version IS 'Версия записи'; + COMMENT ON COLUMN metrics.recruitment.created_at IS 'Дата создания'; + COMMENT ON COLUMN metrics.recruitment.updated_at IS 'Дата обновления'; + COMMENT ON COLUMN metrics.recruitment.schema IS 'Схема'; + COMMENT ON COLUMN metrics.recruitment.military_code IS 'Код организации'; + COMMENT ON COLUMN metrics.recruitment.shortname IS 'Укороченное наименование организации'; + COMMENT ON COLUMN metrics.recruitment.fullname IS 'Полное наименование организации'; + COMMENT ON COLUMN metrics.recruitment.dns IS 'ДНС организации'; + COMMENT ON COLUMN metrics.recruitment.email IS 'Е-mail организации'; + COMMENT ON COLUMN metrics.recruitment.phone IS 'Телефон организации'; + COMMENT ON COLUMN metrics.recruitment.address IS 'Адрес организации'; + COMMENT ON COLUMN metrics.recruitment.address_id IS 'Идентификатор адреса организации'; + COMMENT ON COLUMN metrics.recruitment.postal_address IS 'Почтовый адрес организации'; + COMMENT ON COLUMN metrics.recruitment.postal_address_id IS 'Идентификатор почтового адреса организации'; + COMMENT ON COLUMN metrics.recruitment.nsi_department_id IS 'Идентификатор департамента из НСИ'; + COMMENT ON COLUMN metrics.recruitment.nsi_organization_id IS 'Идентификатор организации из НСИ'; + COMMENT ON COLUMN metrics.recruitment.oktmo IS 'ОКТМО'; + COMMENT ON COLUMN metrics.recruitment.org_ogrn IS 'ОГРН организации'; + COMMENT ON COLUMN metrics.recruitment.dep_ogrn IS 'ОГРН департамента'; + COMMENT ON COLUMN metrics.recruitment.epgu_id IS 'Идентификатор ЕПГУ'; + COMMENT ON COLUMN metrics.recruitment.kpp IS 'КПП'; + COMMENT ON COLUMN metrics.recruitment.inn IS 'ИНН'; + COMMENT ON COLUMN metrics.recruitment.okato IS 'ОКАТО'; + COMMENT ON COLUMN metrics.recruitment.division_type IS 'Тип дивизиона'; + COMMENT ON COLUMN metrics.recruitment.tns_department_id IS 'Идентификатор департамента из ТНС'; + COMMENT ON COLUMN metrics.recruitment.enabled IS 'Признак актуальности'; + COMMENT ON COLUMN metrics.recruitment.timezone IS 'Часовой пояс'; + COMMENT ON COLUMN metrics.recruitment.reports_enabled IS 'Признак актуальности для отчета'; + COMMENT ON COLUMN metrics.recruitment.region_id IS 'Идентификатор региона'; + COMMENT ON COLUMN metrics.recruitment.subpoena_series_code IS 'Серия'; + COMMENT ON COLUMN metrics.recruitment.hidden IS 'Признак скрытого'; + CREATE INDEX IF NOT EXISTS recruitment_idm_idx ON metrics.recruitment (idm_id); + CREATE INDEX IF NOT EXISTS recruitment_military_code_idx ON metrics.recruitment (military_code); + CREATE INDEX IF NOT EXISTS recruitment_parent_idx ON metrics.recruitment (parent_id); + CREATE INDEX IF NOT EXISTS recruitment_region_idx ON metrics.recruitment (region_id); + + + + + add tables for convertation info + + CREATE TABLE IF NOT EXISTS metrics.convert_info_records_from_easu + ( + convert_info_records_from_easu_id bigserial NOT NULL PRIMARY KEY, + recruitment_id uuid NOT NULL constraint fk_conv_info_records_from_easu_recruitment_id references metrics.recruitment, + update_date timestamp without time zone NOT NULL DEFAULT now(), + info_date date NOT NULL, + count_all bigint NOT NULL DEFAULT 0, + count_unique bigint NOT NULL DEFAULT 0, + count_identified bigint NOT NULL DEFAULT 0 + ) + WITH (OIDS = FALSE); + ALTER TABLE IF EXISTS metrics.convert_info_records_from_easu OWNER to ervu_business_metrics; + + COMMENT ON TABLE metrics.convert_info_records_from_easu IS 'Загрузка Данных из ЕАСУ "ГОризонт-М"'; + + CREATE INDEX IF NOT EXISTS idx_convert_info_records_from_easu_date ON metrics.convert_info_records_from_easu (info_date); + CREATE INDEX IF NOT EXISTS idx_convert_info_records_from_easu_recr ON metrics.convert_info_records_from_easu (recruitment_id); + CREATE INDEX IF NOT EXISTS idx_convert_info_records_from_easu_recr_date ON metrics.convert_info_records_from_easu (recruitment_id, info_date); + + CREATE TABLE IF NOT EXISTS metrics.convert_info_not_identifited_records + ( + convert_info_not_identifited_records_id bigserial NOT NULL PRIMARY KEY, + recruitment_id uuid NOT NULL constraint fk_conv_info_records_from_easu_recruitment_id references metrics.recruitment, + update_date timestamp without time zone NOT NULL DEFAULT now(), + info_date date NOT NULL, + count_not_in_csv bigint NOT NULL DEFAULT 0, + count_not_in_xml bigint NOT NULL DEFAULT 0 + ) + WITH (OIDS = FALSE); + ALTER TABLE IF EXISTS metrics.convert_info_not_identifited_records OWNER to ervu_business_metrics; + + COMMENT ON TABLE metrics.convert_info_not_identifited_records IS 'записи неидентифицированные в ГИР ВУ'; + + CREATE INDEX IF NOT EXISTS idx_convert_info_not_identifited_records_date ON metrics.convert_info_not_identifited_records (info_date); + CREATE INDEX IF NOT EXISTS idx_convert_info_not_identifited_records_recr ON metrics.convert_info_not_identifited_records (recruitment_id); + CREATE INDEX IF NOT EXISTS idx_convert_info_not_identifited_records_recr_date ON metrics.convert_info_not_identifited_records (recruitment_id, info_date); + + + CREATE TABLE IF NOT EXISTS metrics.convert_info_loaded_records + ( + convert_info_loaded_records_id bigserial NOT NULL PRIMARY KEY, + recruitment_id uuid NOT NULL constraint fk_conv_info_records_from_easu_recruitment_id references metrics.recruitment, + update_date timestamp without time zone NOT NULL DEFAULT now(), + info_date date NOT NULL, + count_success bigint NOT NULL DEFAULT 0, + count_error bigint NOT NULL DEFAULT 0 + ) + WITH (OIDS = FALSE); + ALTER TABLE IF EXISTS metrics.convert_info_loaded_records OWNER to ervu_business_metrics; + + COMMENT ON TABLE metrics.convert_info_loaded_records IS 'загрузка записей в ГИС ЕРВУ'; + + CREATE INDEX IF NOT EXISTS idx_convert_info_loaded_records_date ON metrics.convert_info_loaded_records (info_date); + CREATE INDEX IF NOT EXISTS idx_convert_info_loaded_records_recr ON metrics.convert_info_loaded_records (recruitment_id); + CREATE INDEX IF NOT EXISTS idx_convert_info_loaded_records_recr_date ON metrics.convert_info_loaded_records (recruitment_id, info_date); + + + CREATE TABLE IF NOT EXISTS metrics.convert_info_common_results + ( + convert_info_common_results_id bigserial NOT NULL PRIMARY KEY, + recruitment_id uuid NOT NULL constraint fk_conv_info_records_from_easu_recruitment_id references metrics.recruitment, + update_date timestamp without time zone NOT NULL DEFAULT now(), + info_date date NOT NULL, + count_confirmed bigint NOT NULL DEFAULT 0, + count_signed bigint NOT NULL DEFAULT 0, + count_manual_convert bigint NOT NULL DEFAULT 0, + count_canceled bigint NOT NULL DEFAULT 0 + ) + WITH (OIDS = FALSE); + ALTER TABLE IF EXISTS metrics.convert_info_common_results OWNER to ervu_business_metrics; + + COMMENT ON TABLE metrics.convert_info_common_results IS 'Конвертация. Результаты'; + + CREATE INDEX IF NOT EXISTS idx_convert_info_common_results_date ON metrics.convert_info_common_results (info_date); + CREATE INDEX IF NOT EXISTS idx_convert_info_common_results_recr ON metrics.convert_info_common_results (recruitment_id); + CREATE INDEX IF NOT EXISTS idx_convert_info_common_results_recr_date ON metrics.convert_info_common_results (recruitment_id, info_date); + + CREATE TABLE IF NOT EXISTS metrics.convert_info_sent_to_lk_epgu + ( + convert_info_sent_to_lk_epgu_id bigserial NOT NULL PRIMARY KEY, + recruitment_id uuid NOT NULL constraint fk_conv_info_records_from_easu_recruitment_id references metrics.recruitment, + update_date timestamp without time zone NOT NULL DEFAULT now(), + info_date date NOT NULL, + count_status_formed bigint NOT NULL DEFAULT 0, + count_sended bigint NOT NULL DEFAULT 0, + count_delivered bigint NOT NULL DEFAULT 0, + count_error bigint NOT NULL DEFAULT 0, + count_viewed bigint NOT NULL DEFAULT 0, + count_not_viewed bigint NOT NULL DEFAULT 0, + count_status_not_formed bigint NOT NULL DEFAULT 0 + ) + WITH (OIDS = FALSE); + ALTER TABLE IF EXISTS metrics.convert_info_sent_to_lk_epgu OWNER to ervu_business_metrics; + + COMMENT ON TABLE metrics.convert_info_sent_to_lk_epgu IS 'Конвертация. ДОставка уведомлений в ЛК на ЕПГУ'; + + CREATE INDEX IF NOT EXISTS idx_convert_info_sent_to_lk_epgu_date ON metrics.convert_info_sent_to_lk_epgu (info_date); + CREATE INDEX IF NOT EXISTS idx_convert_info_sent_to_lk_epgu_recr ON metrics.convert_info_sent_to_lk_epgu (recruitment_id); + CREATE INDEX IF NOT EXISTS idx_convert_info_sent_to_lk_epgu_recr_date ON metrics.convert_info_sent_to_lk_epgu (recruitment_id, info_date); + + + CREATE TABLE IF NOT EXISTS metrics.convert_info_comparison_csv_xml + ( + convert_info_comparison_csv_xml_id bigserial NOT NULL PRIMARY KEY, + recruitment_id uuid NOT NULL constraint fk_conv_info_records_from_easu_recruitment_id references metrics.recruitment, + update_date timestamp without time zone NOT NULL DEFAULT now(), + info_date date NOT NULL, + count_xml_formed bigint NOT NULL DEFAULT 0, + count_csv bigint NOT NULL DEFAULT 0 + ) + WITH (OIDS = FALSE); + ALTER TABLE IF EXISTS metrics.convert_info_comparison_csv_xml OWNER to ervu_business_metrics; + + COMMENT ON TABLE metrics.convert_info_comparison_csv_xml IS 'Конвертация. Результат сопоставления файлов'; + + CREATE INDEX IF NOT EXISTS idx_convert_info_comparison_csv_xml_date ON metrics.convert_info_comparison_csv_xml (info_date); + CREATE INDEX IF NOT EXISTS idx_convert_info_comparison_csv_xml_recr ON metrics.convert_info_comparison_csv_xml (recruitment_id); + CREATE INDEX IF NOT EXISTS idx_convert_info_comparison_csv_xml_recr_date ON metrics.convert_info_comparison_csv_xml (recruitment_id, info_date); + + + + + add tables in schema init_registration_info + + CREATE SCHEMA IF NOT EXISTS init_registration_info; + + CREATE TABLE IF NOT EXISTS init_registration_info.citizens_next_year_age + ( + citizens_next_year_age_id bigserial NOT NULL PRIMARY KEY, + recruitment_id uuid NOT NULL constraint fk_conv_info_records_from_easu_recruitment_id references metrics.recruitment, + update_date timestamp without time zone NOT NULL DEFAULT now(), + info_date date NOT NULL, + info_source varchar NOT NULL, + info_age varchar NOT NULL, + count_all bigint NOT NULL DEFAULT 0 + ) + WITH (OIDS = FALSE); + ALTER TABLE IF EXISTS init_registration_info.citizens_next_year_age OWNER to ervu_business_metrics; + + COMMENT ON TABLE init_registration_info.citizens_next_year_age IS 'Первоначальная постановка на учет. Данные по количеству гражан на учете в возрасте 17 или 18 лет и по источнику самих данных'; + COMMENT ON COLUMN init_registration_info.citizens_next_year_age.info_source IS 'информация об источнике - PERSONAL_VISIT, GIR_VU, EPGU'; + COMMENT ON COLUMN init_registration_info.citizens_next_year_age.info_age IS 'Информациия о каком возрасте 17_YEARS, 18_YEAR'; + + CREATE INDEX IF NOT EXISTS idx_citizens_next_year_age_date ON init_registration_info.citizens_next_year_age (info_date); + CREATE INDEX IF NOT EXISTS idx_citizens_next_year_age_recr ON init_registration_info.citizens_next_year_age (recruitment_id); + CREATE INDEX IF NOT EXISTS idx_citizens_next_year_age_recr_date ON init_registration_info.citizens_next_year_age (recruitment_id, info_date); + + CREATE TABLE IF NOT EXISTS init_registration_info.records_info_id_uk_id_ern + ( + records_info_id_uk_id_ern_id bigserial NOT NULL PRIMARY KEY, + recruitment_id uuid NOT NULL constraint fk_conv_info_records_from_easu_recruitment_id references metrics.recruitment, + update_date timestamp without time zone NOT NULL DEFAULT now(), + info_date date NOT NULL, + info_source varchar NOT NULL, + info_age varchar NOT NULL, + count_all bigint NOT NULL DEFAULT 0, + records_with_id_uk bigint NOT NULL DEFAULT 0, + records_without_id_uk bigint NOT NULL DEFAULT 0, + records_with_id_ern bigint NOT NULL DEFAULT 0 + ) + WITH (OIDS = FALSE); + ALTER TABLE IF EXISTS init_registration_info.records_info_id_uk_id_ern OWNER to ervu_business_metrics; + + COMMENT ON TABLE init_registration_info.records_info_id_uk_id_ern IS 'Первоначальная постановка на учет. Информация о налиции ИД ЕРН и ИД УК'; + COMMENT ON COLUMN init_registration_info.records_info_id_uk_id_ern.info_source IS 'Источник - PERSONAL_VISIT, GIR_VU, EPGU'; + COMMENT ON COLUMN init_registration_info.records_info_id_uk_id_ern.info_age IS 'Информациия о каком возрасте 17_YEARS, 18_YEAR'; + + CREATE INDEX IF NOT EXISTS idx_records_info_id_uk_id_ern_date ON init_registration_info.records_info_id_uk_id_ern (info_date); + CREATE INDEX IF NOT EXISTS idx_records_info_id_uk_id_ern_recr ON init_registration_info.records_info_id_uk_id_ern (recruitment_id); + CREATE INDEX IF NOT EXISTS idx_records_info_id_uk_id_ern_recr_date ON init_registration_info.records_info_id_uk_id_ern (recruitment_id, info_date); + + + CREATE TABLE IF NOT EXISTS init_registration_info.info_sent_to_lk_epgu + ( + info_sent_to_lk_epgu_id bigserial NOT NULL PRIMARY KEY, + recruitment_id uuid NOT NULL constraint fk_conv_info_records_from_easu_recruitment_id references metrics.recruitment, + update_date timestamp without time zone NOT NULL DEFAULT now(), + info_date date NOT NULL, + info_source varchar NOT NULL, + info_age varchar NOT NULL, + count_status_formed bigint NOT NULL DEFAULT 0, + count_sended bigint NOT NULL DEFAULT 0, + count_delivered bigint NOT NULL DEFAULT 0, + count_error bigint NOT NULL DEFAULT 0, + count_viewed bigint NOT NULL DEFAULT 0, + count_not_viewed bigint NOT NULL DEFAULT 0, + count_status_not_formed bigint NOT NULL DEFAULT 0 + ) + WITH (OIDS = FALSE); + ALTER TABLE IF EXISTS init_registration_info.info_sent_to_lk_epgu OWNER to ervu_business_metrics; + + COMMENT ON TABLE init_registration_info.info_sent_to_lk_epgu IS 'Первоначальная постановка на учет. ДОставка уведомлений в ЛК на ЕПГУ'; + COMMENT ON COLUMN init_registration_info.info_sent_to_lk_epgu.info_source IS 'информация об источнике - PERSONAL_VISIT, GIR_VU, EPGU'; + COMMENT ON COLUMN init_registration_info.info_sent_to_lk_epgu.info_age IS 'Информациия о каком возрасте 17_YEARS, 18_YEAR'; + + CREATE INDEX IF NOT EXISTS idx_info_sent_to_lk_epgu_date ON init_registration_info.info_sent_to_lk_epgu (info_date); + CREATE INDEX IF NOT EXISTS idx_info_sent_to_lk_epgu_recr ON init_registration_info.info_sent_to_lk_epgu (recruitment_id); + CREATE INDEX IF NOT EXISTS idx_info_sent_to_lk_epgu_recr_date ON init_registration_info.info_sent_to_lk_epgu (recruitment_id, info_date); + + + + CREATE TABLE IF NOT EXISTS init_registration_info.decision_formation_status + ( + decision_formation_status_id bigserial NOT NULL PRIMARY KEY, + recruitment_id uuid NOT NULL constraint fk_conv_info_records_from_easu_recruitment_id references metrics.recruitment, + update_date timestamp without time zone NOT NULL DEFAULT now(), + info_date date NOT NULL, + info_source varchar NOT NULL, + info_age varchar NOT NULL, + count_signed bigint NOT NULL DEFAULT 0, + count_suggested bigint NOT NULL DEFAULT 0, + count_waiting_sign bigint NOT NULL DEFAULT 0 + ) + WITH (OIDS = FALSE); + ALTER TABLE IF EXISTS init_registration_info.decision_formation_status OWNER to ervu_business_metrics; + + COMMENT ON TABLE init_registration_info.decision_formation_status IS 'Первоначальная постановка на учет. Статус формирования решений'; + COMMENT ON COLUMN init_registration_info.decision_formation_status.info_source IS 'информация об источнике - PERSONAL_VISIT, GIR_VU, EPGU'; + COMMENT ON COLUMN init_registration_info.decision_formation_status.info_age IS 'Информациия о каком возрасте 17_YEARS, 18_YEAR'; + COMMENT ON COLUMN init_registration_info.decision_formation_status.count_suggested IS 'Предпоставлено'; + + CREATE INDEX IF NOT EXISTS idx_decision_formation_status_date ON init_registration_info.decision_formation_status (info_date); + CREATE INDEX IF NOT EXISTS idx_decision_formation_status_recr ON init_registration_info.decision_formation_status (recruitment_id); + CREATE INDEX IF NOT EXISTS idx_decision_formation_status_recr_date ON init_registration_info.decision_formation_status (recruitment_id, info_date); + + + CREATE TABLE IF NOT EXISTS init_registration_info.incidents_info + ( + incidents_info_id bigserial NOT NULL PRIMARY KEY, + recruitment_id uuid NOT NULL constraint fk_conv_info_records_from_easu_recruitment_id references metrics.recruitment, + update_date timestamp without time zone NOT NULL DEFAULT now(), + info_date date NOT NULL, + info_source varchar NOT NULL, + info_age varchar NOT NULL, + count_without_id_ern bigint NOT NULL DEFAULT 0, + count_discrepancy_epgu_info bigint NOT NULL DEFAULT 0 + ) + WITH (OIDS = FALSE); + ALTER TABLE IF EXISTS init_registration_info.incidents_info OWNER to ervu_business_metrics; + + COMMENT ON TABLE init_registration_info.incidents_info IS 'Первоначальная постановка на учет. Инциденты'; + COMMENT ON COLUMN init_registration_info.incidents_info.info_source IS 'информация об источнике - PERSONAL_VISIT, EPGU'; + COMMENT ON COLUMN init_registration_info.incidents_info.info_age IS 'Информациия о каком возрасте 17_YEARS, 18_YEAR'; + + + CREATE INDEX IF NOT EXISTS idx_incidents_info_date ON init_registration_info.incidents_info (info_date); + CREATE INDEX IF NOT EXISTS idx_incidents_info_recr ON init_registration_info.incidents_info (recruitment_id); + CREATE INDEX IF NOT EXISTS idx_incidents_info_recr_date ON init_registration_info.incidents_info (recruitment_id, info_date); + + + CREATE TABLE IF NOT EXISTS init_registration_info.init_registration_from_gir_vu + ( + init_registration_from_gir_vu_id bigserial NOT NULL PRIMARY KEY, + recruitment_id uuid NOT NULL constraint fk_conv_info_records_from_easu_recruitment_id references metrics.recruitment, + update_date timestamp without time zone NOT NULL DEFAULT now(), + info_date date NOT NULL, + count_all bigint NOT NULL DEFAULT 0, + count_womens bigint NOT NULL DEFAULT 0, + count_received_citizenship bigint NOT NULL DEFAULT 0 + ) + WITH (OIDS = FALSE); + ALTER TABLE IF EXISTS init_registration_info.init_registration_from_gir_vu OWNER to ervu_business_metrics; + + COMMENT ON TABLE init_registration_info.init_registration_from_gir_vu IS 'Первоначальная постановка на учет. Первоначальная постановка на учет по данным из ГИР ВУ'; + + CREATE INDEX IF NOT EXISTS idx_init_registration_from_gir_vu_date ON init_registration_info.init_registration_from_gir_vu (info_date); + CREATE INDEX IF NOT EXISTS idx_init_registration_from_gir_vu_recr ON init_registration_info.init_registration_from_gir_vu (recruitment_id); + CREATE INDEX IF NOT EXISTS idx_init_registration_from_gir_vu_recr_date ON init_registration_info.init_registration_from_gir_vu (recruitment_id, info_date); + + + CREATE TABLE IF NOT EXISTS init_registration_info.applications_received_from_epgu + ( + applications_received_from_epgu_id bigserial NOT NULL PRIMARY KEY, + recruitment_id uuid NOT NULL constraint fk_conv_info_records_from_easu_recruitment_id references metrics.recruitment, + update_date timestamp without time zone NOT NULL DEFAULT now(), + info_date date NOT NULL, + count_all bigint NOT NULL DEFAULT 0, + count_executor_appointed bigint NOT NULL DEFAULT 0, + count_registered bigint NOT NULL DEFAULT 0, + count_registration_refusal bigint NOT NULL DEFAULT 0, + count_refusal_provide_service bigint NOT NULL DEFAULT 0 + ) + WITH (OIDS = FALSE); + ALTER TABLE IF EXISTS init_registration_info.applications_received_from_epgu OWNER to ervu_business_metrics; + + COMMENT ON TABLE init_registration_info.applications_received_from_epgu IS 'Первоначальная постановка на учет. Первоначальная постановка на учет по данным из ГИР ВУ'; + + CREATE INDEX IF NOT EXISTS idx_applications_received_from_epgu_date ON init_registration_info.applications_received_from_epgu (info_date); + CREATE INDEX IF NOT EXISTS idx_applications_received_from_epgu_recr ON init_registration_info.applications_received_from_epgu (recruitment_id); + CREATE INDEX IF NOT EXISTS idx_applications_received_from_epgu_recr_date ON init_registration_info.applications_received_from_epgu (recruitment_id, info_date); + + + CREATE TABLE IF NOT EXISTS init_registration_info.statuses_decisions_on_epgu + ( + statuses_decisions_on_epgu_id bigserial NOT NULL PRIMARY KEY, + recruitment_id uuid NOT NULL constraint fk_conv_info_records_from_easu_recruitment_id references metrics.recruitment, + update_date timestamp without time zone NOT NULL DEFAULT now(), + info_date date NOT NULL, + count_loaded bigint NOT NULL DEFAULT 0, + count_signed bigint NOT NULL DEFAULT 0, + count_formed_for_signing bigint NOT NULL DEFAULT 0 + ) + WITH (OIDS = FALSE); + ALTER TABLE IF EXISTS init_registration_info.statuses_decisions_on_epgu OWNER to ervu_business_metrics; + + COMMENT ON TABLE init_registration_info.statuses_decisions_on_epgu IS 'Первоначальная постановка на учет. Статусы решений по Первоначальной постановке на учет(ЕПГУ)'; + + CREATE INDEX IF NOT EXISTS idx_statuses_decisions_on_epgu_date ON init_registration_info.statuses_decisions_on_epgu (info_date); + CREATE INDEX IF NOT EXISTS idx_statuses_decisions_on_epgu_recr ON init_registration_info.statuses_decisions_on_epgu (recruitment_id); + CREATE INDEX IF NOT EXISTS idx_statuses_decisions_on_epgu_recr_date ON init_registration_info.statuses_decisions_on_epgu (recruitment_id, info_date); + + + + + + + + + + + + + \ No newline at end of file diff --git a/db/src/main/resources/changelog/v_0.1/changelog-0.1.xml b/db/src/main/resources/changelog/v_0.1/changelog-0.1.xml new file mode 100644 index 0000000..e8ee533 --- /dev/null +++ b/db/src/main/resources/changelog/v_0.1/changelog-0.1.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/db/src/main/resources/properties/ervu_business_metrics.properties b/db/src/main/resources/properties/ervu_business_metrics.properties new file mode 100644 index 0000000..b3da948 --- /dev/null +++ b/db/src/main/resources/properties/ervu_business_metrics.properties @@ -0,0 +1,11 @@ +changeLogFile = src/main/resources/changelog/changelog-master.xml +databaseChangeLogTableName = metricsdbchangelog +databaseChangeLogLockTableName = metricsdbchangelock +driver = org.postgresql.Driver +url = jdbc:postgresql://10.10.31.119/ervu_business_metrics +username = ervu_business_metrics +password = ervu_business_metrics +verbose = true +logging = debug +liquibaseSchemaName = public +defaultSchemaName = public \ No newline at end of file diff --git a/pom.xml b/pom.xml index 531d14d..e0c5c1e 100644 --- a/pom.xml +++ b/pom.xml @@ -9,6 +9,7 @@ backend resources + db scm:git:git://gitserver/webbpm/webbpm-components.git