alter VIEW registration_change_address.view_personal_info_stat

This commit is contained in:
Булат Хайруллин 2025-05-07 03:43:21 +03:00
parent 6daf522562
commit e759681344
2 changed files with 27 additions and 0 deletions

View file

@ -0,0 +1,26 @@
<?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="hairullin">
<comment>ALTER VIEW registration_change_address.view_personal_info_stat</comment>
<sql>
CREATE OR REPLACE VIEW registration_change_address.view_personal_info_stat
AS
SELECT personal_info_stat.personal_info_stat_id,
personal_info_stat.count_refused + personal_info_stat.count_accepted_to_send + personal_info_stat.count_unloaded AS count_all,
COALESCE(round(personal_info_stat.count_refused::numeric * 100::numeric / NULLIF((personal_info_stat.count_refused + personal_info_stat.count_accepted_to_send + personal_info_stat.count_unloaded)::numeric, 0::numeric)), 0::numeric) AS percent_refused,
COALESCE(round(personal_info_stat.count_unloaded::numeric * 100::numeric / NULLIF((personal_info_stat.count_refused + personal_info_stat.count_accepted_to_send + personal_info_stat.count_unloaded)::numeric, 0::numeric)), 0::numeric) AS percent_unloaded,
COALESCE(round(personal_info_stat.count_accepted_to_send::numeric * 100::numeric / NULLIF((personal_info_stat.count_refused + personal_info_stat.count_accepted_to_send + personal_info_stat.count_unloaded)::numeric, 0::numeric)), 0::numeric) AS percent_accepted_to_send
FROM registration_change_address.personal_info_stat;
ALTER TABLE registration_change_address.view_personal_info_stat
OWNER TO ervu_business_metrics;
</sql>
</changeSet>
</databaseChangeLog>

View file

@ -30,6 +30,7 @@
<include file="20250418-SUPPORT-9122_add_idm.xml" relativeToChangelogFile="true"/>
<include file="20250423-db_changes.xml" relativeToChangelogFile="true"/>
<include file="20250505-db_changes.xml" relativeToChangelogFile="true"/>
<include file="20250507-db_changes.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>