-
Notifications
You must be signed in to change notification settings - Fork 0
fix(all_urls):SP-4237 add is_mined and package_hash filter condition… #12
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
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 |
|---|---|---|
|
|
@@ -71,7 +71,9 @@ func (m *AllUrlsModel) GetURLsByPurlNameType(ctx context.Context, purlName, purl | |
| " LEFT JOIN mines m ON u.mine_id = m.id" + | ||
| " LEFT JOIN licenses l ON u.license_id = l.id" + | ||
| " LEFT JOIN versions v ON u.version_id = v.id" + | ||
| " WHERE m.purl_type = $1 AND u.purl_name = $2 ORDER BY date DESC" | ||
| " WHERE m.purl_type = $1 AND u.purl_name = $2" + | ||
| " AND u.is_mined != false AND u.package_hash != ''" + | ||
|
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. Could is_mined flag be configurable throw a parameter? |
||
| " ORDER BY date DESC" | ||
|
Comment on lines
+74
to
+76
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. Blocking: new filters break queries on current DB schema. The added predicates on Lines [75], [115], [148], and [179] are causing runtime SQL failures ( Please ship this with matching schema support (migration + fixtures) or add a compatibility path for DBs that don’t yet have Also applies to: 114-116, 147-149, 178-179 🤖 Prompt for AI Agents |
||
|
|
||
| var allUrls []AllURL | ||
| err := m.db.SelectContext(ctx, &allUrls, query, purlType, purlName) | ||
|
|
@@ -109,7 +111,9 @@ func (m *AllUrlsModel) GetURLsByPurlNameTypeVersion(ctx context.Context, purlNam | |
| " LEFT JOIN mines m ON u.mine_id = m.id" + | ||
| " LEFT JOIN licenses l ON u.license_id = l.id" + | ||
| " LEFT JOIN versions v ON u.version_id = v.id" + | ||
| " WHERE m.purl_type = $1 AND u.purl_name = $2 AND (v.version_name = $3 OR v.version_name = $4) ORDER BY date DESC" | ||
| " WHERE m.purl_type = $1 AND u.purl_name = $2 AND (v.version_name = $3 OR v.version_name = $4)" + | ||
| " AND u.is_mined != false AND u.package_hash != ''" + | ||
| " ORDER BY date DESC" | ||
|
|
||
| var allUrls []AllURL | ||
| err := m.db.SelectContext(ctx, &allUrls, query, purlType, purlName, purlVersion, semverV) | ||
|
|
@@ -140,7 +144,9 @@ func (m *AllUrlsModel) GetVersionsByPurlNameType(ctx context.Context, purlName, | |
| " LEFT JOIN mines m ON u.mine_id = m.id" + | ||
| " LEFT JOIN licenses l ON u.license_id = l.id" + | ||
| " LEFT JOIN versions v ON u.version_id = v.id" + | ||
| " WHERE m.purl_type = $1 AND u.purl_name = $2 ORDER BY date DESC" | ||
| " WHERE m.purl_type = $1 AND u.purl_name = $2" + | ||
| " AND u.is_mined != false AND u.package_hash != ''" + | ||
| " ORDER BY date DESC" | ||
|
|
||
| var allUrls []AllURL | ||
| err := m.db.SelectContext(ctx, &allUrls, query, purlType, purlName) | ||
|
|
@@ -169,7 +175,8 @@ func (m *AllUrlsModel) CheckPurlByNameType(ctx context.Context, purlName string, | |
| "SELECT EXISTS("+ | ||
| "SELECT 1 FROM all_urls au"+ | ||
| " INNER JOIN mines m ON au.mine_id = m.id"+ | ||
| " WHERE au.purl_name = $1 AND m.purl_type = $2)", | ||
| " WHERE au.purl_name = $1 AND m.purl_type = $2"+ | ||
| " AND au.is_mined != false AND au.package_hash != '')", | ||
| purlName, purlType).Scan(&exists) | ||
| if err != nil { | ||
| s.Errorf("Error: Failed to query all_urls table for %v, %v: %v", purlName, purlType, err) | ||
|
|
||
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.
Changelog entry is missing one updated query method.
Line [12] documents three methods, but this PR also changes
CheckPurlByNameTypeinpkg/models/all_urls.go(Lines [178-179]). Please include it to keep release notes accurate.Suggested changelog tweak
📝 Committable suggestion
🤖 Prompt for AI Agents