View cleanup, show changes as changes

This commit is contained in:
Jan Kvetina 2022-01-21 22:35:50 +01:00
parent cf38735fe0
commit 7f89d93855

View File

@ -14,13 +14,14 @@ c AS (
r.region_id, r.region_id,
c.table_name, c.table_name,
--c.data_length, c.nullable --c.data_length, c.nullable
c.column_name || ' (' || c.column_name,
--
CASE REGEXP_REPLACE(c.data_type, '\(\d+\)', '') CASE REGEXP_REPLACE(c.data_type, '\(\d+\)', '')
WHEN 'CHAR' THEN 'VARCHAR2' WHEN 'CHAR' THEN 'VARCHAR2'
WHEN 'INTERVAL DAY TO SECOND' THEN 'INTERVAL_D2S' WHEN 'INTERVAL DAY TO SECOND' THEN 'INTERVAL_D2S'
WHEN 'TIMESTAMP WITH TIME ZONE' THEN 'TIMESTAMP_TZ' WHEN 'TIMESTAMP WITH TIME ZONE' THEN 'TIMESTAMP_TZ'
ELSE REGEXP_REPLACE(c.data_type, '\(\d+\)', '') ELSE REGEXP_REPLACE(c.data_type, '\(\d+\)', '')
END || ')' AS column_desc END AS data_type
FROM user_tab_cols c FROM user_tab_cols c
JOIN apex_application_page_regions r JOIN apex_application_page_regions r
ON r.table_name = c.table_name ON r.table_name = c.table_name
@ -34,7 +35,8 @@ b AS (
c.region_id, c.region_id,
r.table_name, r.table_name,
--c.max_length, c.is_required, --c.max_length, c.is_required,
c.source_expression || ' (' || c.data_type || ')' AS column_desc c.source_expression AS column_name,
c.data_type
FROM apex_appl_page_ig_columns c FROM apex_appl_page_ig_columns c
JOIN apex_application_page_regions r JOIN apex_application_page_regions r
ON r.application_id = c.application_id ON r.application_id = c.application_id
@ -51,21 +53,17 @@ d AS (
NVL(c.region_id, b.region_id) AS region_id, NVL(c.region_id, b.region_id) AS region_id,
NVL(c.table_name, b.table_name) AS table_name, NVL(c.table_name, b.table_name) AS table_name,
-- --
MAX(CASE
WHEN c.table_name IS NULL THEN 'Y'
WHEN b.table_name IS NULL THEN 'Y'
END) AS fix_sync,
--
LISTAGG(CASE LISTAGG(CASE
WHEN c.table_name IS NULL THEN 'Removed ' || b.column_desc WHEN c.table_name IS NULL THEN 'Removed ' || b.column_name || ' (' || b.data_type || ')'
WHEN b.table_name IS NULL THEN 'Added ' || c.column_desc WHEN b.table_name IS NULL THEN 'Added ' || c.column_name || ' (' || c.data_type || ')'
END, CHR(10)) WITHIN GROUP (ORDER BY b.column_desc, c.column_desc) AS fix_sync_title ELSE 'Changed ' || b.column_name || ' from ' || b.data_type || ' to ' || c.data_type
END, CHR(10)) WITHIN GROUP (ORDER BY b.column_name, c.column_name) AS fix_sync
FROM b FROM b
FULL JOIN c FULL JOIN c
ON c.region_id = b.region_id ON c.region_id = b.region_id
AND c.table_name = b.table_name AND c.table_name = b.table_name
AND c.column_desc = b.column_desc AND c.column_name = b.column_name
WHERE NVL(c.column_desc, '-') != NVL(b.column_desc, '-') WHERE NVL(c.data_type, '-') != NVL(b.data_type, '-')
GROUP BY NVL(c.region_id, b.region_id), NVL(c.table_name, b.table_name) GROUP BY NVL(c.region_id, b.region_id), NVL(c.table_name, b.table_name)
) )
SELECT SELECT
@ -115,6 +113,8 @@ SELECT
) AS table_link, ) AS table_link,
-- --
CASE CASE
WHEN r.source_type_code != 'NATIVE_IG'
THEN NULL
WHEN NVL(g.add_row_if_empty, 'No') = 'No' WHEN NVL(g.add_row_if_empty, 'No') = 'No'
AND g.select_first_row = 'No' AND g.select_first_row = 'No'
AND g.pagination_type = 'Page' AND g.pagination_type = 'Page'
@ -133,7 +133,7 @@ SELECT
', ')) ', '))
END AS fix_setup, END AS fix_setup,
-- --
CASE WHEN d.fix_sync = 'Y' THEN app.get_icon('fa-warning', d.fix_sync_title) END AS fix_sync, CASE WHEN d.fix_sync IS NOT NULL THEN app.get_icon('fa-warning', d.fix_sync) END AS fix_sync,
-- --
CASE WHEN g.edit_operations LIKE '%i%' THEN 'Y' END AS is_ins_allowed, CASE WHEN g.edit_operations LIKE '%i%' THEN 'Y' END AS is_ins_allowed,
CASE WHEN g.edit_operations LIKE '%u%' THEN 'Y' END AS is_upd_allowed, CASE WHEN g.edit_operations LIKE '%u%' THEN 'Y' END AS is_upd_allowed,