Skip to content

Commit 4db3f76

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

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

database_admin/migrations/142_split_system_platform.up.sql

Lines changed: 16 additions & 0 deletions
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+
RAISE NOTICE 'Created system_inventory';
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+
RAISE NOTICE 'Data loaded into system_inventory';
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+
RAISE NOTICE 'Added triggers, constraints, and indexes to system_inventory';
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+
RAISE NOTICE 'Updated fkey references from system_platform to system_inventory';
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
@@ -504,6 +512,8 @@ BEGIN
504512
END;
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');
549559
SELECT grant_table_partitions('SELECT', 'system_patch', 'manager');
550560
SELECT grant_table_partitions('SELECT', 'system_patch', 'vmaas_sync');
551561

562+
RAISE NOTICE 'Created system_patch';
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+
RAISE NOTICE 'Data loaded into system_patch';
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+
RAISE NOTICE 'Migration 142 end';

0 commit comments

Comments
 (0)