Skip to content

Commit 71f2cb5

Browse files
committed
RHINENG-21214: replace old tables with views
1 parent 159bd78 commit 71f2cb5

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

database_admin/migrations/142_split_system_platform.up.sql

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,3 +537,53 @@ ALTER TABLE IF EXISTS system_patch
537537
ADD PRIMARY KEY (rh_account_id, system_id),
538538
ADD FOREIGN KEY (rh_account_id, template_id) REFERENCES template (rh_account_id, id),
539539
ADD FOREIGN KEY (system_id, rh_account_id) REFERENCES system_inventory (id, rh_account_id);
540+
541+
542+
543+
-- system_platform
544+
DROP TABLE IF EXISTS system_platform;
545+
CREATE OR REPLACE VIEW system_platform AS SELECT
546+
si.id,
547+
si.inventory_id,
548+
si.rh_account_id,
549+
si.vmaas_json,
550+
si.json_checksum,
551+
si.last_updated,
552+
si.unchanged_since,
553+
sp.last_evaluation,
554+
sp.installable_advisory_count_cache,
555+
sp.installable_advisory_enh_count_cache,
556+
sp.installable_advisory_bug_count_cache,
557+
sp.installable_advisory_sec_count_cache,
558+
si.last_upload,
559+
si.stale_timestamp,
560+
si.stale_warning_timestamp,
561+
si.culled_timestamp,
562+
si.stale,
563+
si.display_name,
564+
sp.packages_installed,
565+
sp.packages_installable,
566+
si.reporter_id,
567+
sp.third_party,
568+
si.yum_updates,
569+
sp.applicable_advisory_count_cache,
570+
sp.applicable_advisory_enh_count_cache,
571+
sp.applicable_advisory_bug_count_cache,
572+
sp.applicable_advisory_sec_count_cache,
573+
si.satellite_managed,
574+
si.built_pkgcache,
575+
sp.packages_applicable,
576+
sp.template_id,
577+
si.yum_checksum,
578+
si.arch,
579+
si.bootc
580+
FROM system_inventory si JOIN system_patch sp
581+
ON si.id = sp.system_id AND si.rh_account_id = sp.rh_account_id;
582+
583+
GRANT SELECT, INSERT, UPDATE, DELETE ON system_platform TO listener;
584+
-- evaluator needs to update last_evaluation
585+
GRANT SELECT, UPDATE ON system_platform TO evaluator;
586+
-- manager needs to update cache and delete systems
587+
GRANT SELECT, UPDATE, DELETE ON system_platform TO manager;
588+
-- VMaaS sync needs to be able to perform system culling tasks
589+
GRANT SELECT, UPDATE, DELETE ON system_platform to vmaas_sync;

0 commit comments

Comments
 (0)