Skip to content

Commit c43723e

Browse files
committed
RHINENG-21214: update fkeys to refer to system_inventory
Update tables that refered to system_platform to use system_inventory instead.
1 parent 1609a02 commit c43723e

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

database_admin/migrations/142_split_system_platform.up.sql

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,25 @@ CREATE INDEX IF NOT EXISTS system_inventory_tags_index ON system_inventory USING
146146
CREATE INDEX IF NOT EXISTS system_inventory_stale_timestamp_index ON system_inventory (stale_timestamp);
147147
CREATE INDEX IF NOT EXISTS system_inventory_workspaces_index ON system_inventory USING GIN (workspaces);
148148

149+
-- UPDATE FKEYS
150+
ALTER TABLE IF EXISTS system_repo
151+
DROP CONSTRAINT system_platform_id,
152+
ADD CONSTRAINT system_inventory_id
153+
FOREIGN KEY (rh_account_id, system_id)
154+
REFERENCES system_inventory (rh_account_id, id);
155+
156+
ALTER TABLE IF EXISTS system_advisories
157+
DROP CONSTRAINT system_platform_id,
158+
ADD CONSTRAINT system_inventory_id
159+
FOREIGN KEY (rh_account_id, system_id)
160+
REFERENCES system_inventory (rh_account_id, id);
161+
162+
ALTER TABLE IF EXISTS system_package2
163+
DROP CONSTRAINT system_package2_rh_account_id_system_id_fkey,
164+
ADD CONSTRAINT system_inventory_id
165+
FOREIGN KEY (rh_account_id, system_id)
166+
REFERENCES system_inventory (rh_account_id, id);
167+
149168

150169

151170
-- system_patch

0 commit comments

Comments
 (0)