feat(database): prepare tables for storing affected package information - #2491
Merged
Merged
Conversation
Reviewer's GuideThe database schema is advanced to version 171 with architecture and deduplicated EVR types, a 256-way hash-partitioned vulnerability package detail model, and affected package metadata on existing vulnerable-package records; the baseline schema, upgrade scripts, and table-count test are updated together. Entity relationship diagram for affected package vulnerability dataerDiagram
PACKAGE_NAME ||--o{ SYSTEM_VULNERABILITIES_PKG_DETAIL : identifies
EVR ||--o{ SYSTEM_VULNERABILITIES_PKG_DETAIL : affected_version
EVR ||--o{ SYSTEM_VULNERABILITIES_PKG_DETAIL : fixed_version
SYSTEM_VULNERABILITIES_ACTIVE ||--o{ SYSTEM_VULNERABILITIES_PKG_DETAIL : contains
PACKAGE_NAME {
BIGINT id PK
}
EVR {
INTEGER id PK
INTEGER epoch
TEXT version
TEXT release
}
SYSTEM_VULNERABILITIES_PKG_DETAIL {
INT rh_account_id
BIGINT system_vulnerability_id FK
BIGINT package_name_id FK
INTEGER affected_evr_id FK
arch affected_arch
INTEGER fixed_evr_id FK
arch fixed_arch
}
SYSTEM_VULNERABILITIES_ACTIVE {
BIGINT id PK
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="database/schema/upgrade_scripts/170-add-system-vulnerabilities-pkg-detail.sql" line_range="2" />
<code_context>
+CREATE TABLE IF NOT EXISTS system_vulnerabilities_pkg_detail (
+ rh_account_id INT NOT NULL,
+ system_vulnerability_id BIGINT NOT NULL,
+ package_name_id BIGINT NOT NULL,
</code_context>
<issue_to_address>
**issue (bug_risk):** `system_vulnerabilities_pkg_detail.rh_account_id` is declared as `INT`, while `rh_account.id` and the corresponding `rh_account_id` columns elsewhere are `BIGSERIAL`/`BIGINT`. An account ID above the signed 32-bit range cannot be inserted into this table and raises an integer-out-of-range error.
**Triggers:** When the database contains an account ID greater than 2,147,483,647.
**Suggested fix:** Use `BIGINT` for `rh_account_id` to match `rh_account.id` and the other account-scoped tables.
```suggestion
rh_account_id BIGINT NOT NULL,
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
jdobes
force-pushed
the
package_tables
branch
3 times, most recently
from
September 4, 2026 15:09
bcc3ed3 to
e475b82
Compare
- enum of all current package architectures - evr table for unique epoch+version+release tuples, same design as in vmaas - new partitioned table for system_vulnerabilities details - extension of system_vulnerable_package where the schema already works well with the new feature RHINENG-28511
jdobes
force-pushed
the
package_tables
branch
from
September 4, 2026 15:34
e475b82 to
fcdcc4b
Compare
RostyslavKachan
approved these changes
Sep 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RHINENG-28511
Secure Coding Practices Checklist GitHub Link
Secure Coding Checklist
Summary by Sourcery
Prepare the database schema to record affected package versions and architectures for system vulnerabilities.
New Features:
Enhancements:
Tests: