@@ -55,6 +55,8 @@ GRANT SELECT, USAGE ON SEQUENCE system_inventory_id_seq TO evaluator;
5555GRANT SELECT , USAGE ON SEQUENCE system_inventory_id_seq TO listener;
5656GRANT SELECT , USAGE ON SEQUENCE system_inventory_id_seq TO vmaas_sync;
5757
58+ RAISE NOTICE ' Created system_inventory' ;
59+
5860-- LOAD DATA
5961INSERT INTO system_inventory (
6062 id,
@@ -153,6 +155,8 @@ END $$;
153155DROP FUNCTION safe_to_int;
154156DROP FUNCTION safe_to_uuid;
155157
158+ RAISE NOTICE ' Data loaded into system_inventory' ;
159+
156160-- TRIGGERS
157161SELECT 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
182186CREATE INDEX IF NOT EXISTS system_inventory_stale_timestamp_index ON system_inventory (stale_timestamp);
183187CREATE INDEX IF NOT EXISTS system_inventory_workspaces_index ON system_inventory USING GIN (workspaces);
184188
189+ RAISE NOTICE ' Added triggers, constraints, and indexes to system_inventory' ;
190+
185191-- UPDATE FKEYS
186192ALTER TABLE IF EXISTS system_repo
187193DROP 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+ RAISE NOTICE ' Updated fkey references from system_platform to system_inventory' ;
211+
204212-- UPDATE FUNCTIONS
205213CREATE OR REPLACE FUNCTION on_system_update ()
206214-- this trigger updates advisory_account_data when server changes its stale flag
@@ -504,6 +512,8 @@ BEGIN
504512END;
505513$fun$ LANGUAGE plpgsql;
506514
515+ RAISE NOTICE ' Updated functions to use system_inventory' ;
516+
507517
508518
509519-- system_patch
@@ -549,6 +559,8 @@ SELECT grant_table_partitions('SELECT', 'system_patch', 'listener');
549559SELECT grant_table_partitions(' SELECT' , ' system_patch' , ' manager' );
550560SELECT grant_table_partitions(' SELECT' , ' system_patch' , ' vmaas_sync' );
551561
562+ RAISE NOTICE ' Created system_patch' ;
563+
552564INSERT INTO system_patch SELECT
553565 id,
554566 rh_account_id,
@@ -569,6 +581,8 @@ INSERT INTO system_patch SELECT
569581FROM system_platform sp
570582WHERE sp .stale = false;
571583
584+ RAISE NOTICE ' Data loaded into system_patch' ;
585+
572586-- CONSTRAINTS
573587ALTER TABLE IF EXISTS system_patch
574588ADD PRIMARY KEY (rh_account_id, system_id),
@@ -624,3 +638,5 @@ GRANT SELECT, UPDATE ON system_platform TO evaluator;
624638GRANT SELECT , UPDATE , DELETE ON system_platform TO manager;
625639-- VMaaS sync needs to be able to perform system culling tasks
626640GRANT SELECT , UPDATE , DELETE ON system_platform to vmaas_sync;
641+
642+ RAISE NOTICE ' Migration 142 end' ;
0 commit comments