Skip to content

Commit dd47bf8

Browse files
committed
RHINENG-21214: add notices to migration 142
1 parent 3065654 commit dd47bf8

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

database_admin/migrations/142_split_system_platform.up.sql

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ GRANT SELECT, USAGE ON SEQUENCE system_inventory_id_seq TO evaluator;
5555
GRANT SELECT, USAGE ON SEQUENCE system_inventory_id_seq TO listener;
5656
GRANT SELECT, USAGE ON SEQUENCE system_inventory_id_seq TO vmaas_sync;
5757

58+
do $$ begin RAISE NOTICE 'Created system_inventory'; end $$
59+
5860
-- LOAD DATA
5961
INSERT INTO system_inventory (
6062
id,
@@ -153,6 +155,8 @@ END $$;
153155
DROP FUNCTION safe_to_int;
154156
DROP FUNCTION safe_to_uuid;
155157

158+
do $$ begin RAISE NOTICE 'Data loaded into system_inventory'; end $$
159+
156160
-- TRIGGERS
157161
SELECT create_table_partition_triggers('system_inventory_set_last_updated',
158162
$$BEFORE INSERT OR UPDATE$$,
@@ -182,6 +186,8 @@ CREATE INDEX IF NOT EXISTS system_inventory_tags_index ON system_inventory USING
182186
CREATE INDEX IF NOT EXISTS system_inventory_stale_timestamp_index ON system_inventory (stale_timestamp);
183187
CREATE INDEX IF NOT EXISTS system_inventory_workspaces_index ON system_inventory USING GIN (workspaces);
184188

189+
do $$ begin RAISE NOTICE 'Added triggers, constraints, and indexes to system_inventory'; end $$
190+
185191
-- UPDATE FKEYS
186192
ALTER TABLE IF EXISTS system_repo
187193
DROP CONSTRAINT system_platform_id,
@@ -201,6 +207,8 @@ ADD CONSTRAINT system_inventory_id
201207
FOREIGN KEY (rh_account_id, system_id)
202208
REFERENCES system_inventory (rh_account_id, id);
203209

210+
do $$ begin RAISE NOTICE 'Updated fkey references from system_platform to system_inventory'; end $$
211+
204212
-- UPDATE FUNCTIONS
205213
CREATE OR REPLACE FUNCTION on_system_update()
206214
-- this trigger updates advisory_account_data when server changes its stale flag
@@ -374,7 +382,7 @@ BEGIN
374382
INTO v_system_id, v_account_id;
375383

376384
IF v_system_id IS NULL OR v_account_id IS NULL THEN
377-
RAISE NOTICE 'Not found';
385+
do $$ begin RAISE NOTICE 'Not found'; end $$
378386
RETURN;
379387
END IF;
380388

@@ -504,6 +512,8 @@ BEGIN
504512
END;
505513
$fun$ LANGUAGE plpgsql;
506514

515+
do $$ begin RAISE NOTICE 'Updated functions to use system_inventory'; end $$
516+
507517

508518

509519
-- system_patch
@@ -549,6 +559,8 @@ SELECT grant_table_partitions('SELECT', 'system_patch', 'listener');
549559
SELECT grant_table_partitions('SELECT', 'system_patch', 'manager');
550560
SELECT grant_table_partitions('SELECT', 'system_patch', 'vmaas_sync');
551561

562+
do $$ begin RAISE NOTICE 'Created system_patch'; end $$
563+
552564
INSERT INTO system_patch SELECT
553565
id,
554566
rh_account_id,
@@ -569,6 +581,8 @@ INSERT INTO system_patch SELECT
569581
FROM system_platform sp
570582
WHERE sp.stale = false;
571583

584+
do $$ begin RAISE NOTICE 'Data loaded into system_patch'; end $$
585+
572586
-- CONSTRAINTS
573587
ALTER TABLE IF EXISTS system_patch
574588
ADD PRIMARY KEY (rh_account_id, system_id),
@@ -624,3 +638,5 @@ GRANT SELECT, UPDATE ON system_platform TO evaluator;
624638
GRANT SELECT, UPDATE, DELETE ON system_platform TO manager;
625639
-- VMaaS sync needs to be able to perform system culling tasks
626640
GRANT SELECT, UPDATE, DELETE ON system_platform to vmaas_sync;
641+
642+
do $$ begin RAISE NOTICE 'Migration 142 end'; end $$

0 commit comments

Comments
 (0)