-
Notifications
You must be signed in to change notification settings - Fork 44
RHINENG-26116: create workspace-aware advisories aggregate table #2184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| DROP TABLE IF EXISTS account_advisory; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| CREATE TABLE IF NOT EXISTS account_advisory | ||
| ( | ||
| advisory_id BIGINT NOT NULL, | ||
| rh_account_id INT NOT NULL, | ||
| workspace_id UUID NOT NULL, | ||
| systems_applicable INT NOT NULL DEFAULT 0, | ||
| systems_installable INT NOT NULL DEFAULT 0, | ||
| notified TIMESTAMP WITH TIME ZONE NULL, | ||
| CONSTRAINT account_advisory_advisory_id | ||
| FOREIGN KEY (advisory_id) | ||
| REFERENCES advisory_metadata (id), | ||
| CONSTRAINT account_advisory_rh_account_id | ||
| FOREIGN KEY (rh_account_id) | ||
| REFERENCES rh_account (id), | ||
| PRIMARY KEY (rh_account_id, workspace_id, advisory_id) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PK is, by definition, unique. So another unique index on the same columns is not necessary. |
||
| ) PARTITION BY HASH (rh_account_id); | ||
|
|
||
| SELECT create_table_partitions('account_advisory', 32, | ||
| $$WITH (fillfactor = '70', autovacuum_vacuum_scale_factor = '0.05') | ||
| TABLESPACE pg_default$$); | ||
|
|
||
| SELECT grant_table_partitions('SELECT, INSERT, UPDATE, DELETE', 'account_advisory', 'manager'); | ||
| SELECT grant_table_partitions('SELECT, INSERT, UPDATE, DELETE', 'account_advisory', 'evaluator'); | ||
| SELECT grant_table_partitions('SELECT, INSERT, UPDATE, DELETE', 'account_advisory', 'listener'); | ||
| SELECT grant_table_partitions('SELECT, INSERT, UPDATE, DELETE', 'account_advisory', 'vmaas_sync'); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I overlooked this on my first review:
rh_account_idshould be FK referencingrh_account (id)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, missed that. added now.