fix: refactor project table (CM-1165)#4113
Conversation
|
|
There was a problem hiding this comment.
Pull request overview
This PR introduces a database schema refactor for the projects catalog by removing the separate evaluatedProjects table and reshaping projectCatalog (dropping ossfCriticalityScore, adding source/action/evaluatedAt/onboardedAt, and indexing the new fields).
Changes:
- Drop
evaluatedProjectstable. - Remove
ossfCriticalityScorefromprojectCatalogand addsource,action,evaluatedAt,onboardedAtcolumns. - Add new indexes on
projectCatalog.sourceandprojectCatalog.action.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| backend/src/database/migrations/V1778749030__refactor-projects-catalog.sql | Drops evaluatedProjects, removes ossfCriticalityScore, adds new catalog columns + indexes. |
| backend/src/database/migrations/U1778749030__refactor-projects-catalog.sql | Present but empty undo migration file. |
Comments suppressed due to low confidence (3)
backend/src/database/migrations/V1778749030__refactor-projects-catalog.sql:2
- This migration drops the "evaluatedProjects" table, but the codebase still queries/inserts/updates it (e.g. services/libs/data-access-layer/src/evaluated-projects/evaluatedProjects.ts). If the table is being replaced by projectCatalog columns, the corresponding data-access layer and any workers/jobs need to be updated in the same release to prevent runtime SQL errors after migration.
-- Drop evaluatedProjects table (data migrated into projectCatalog)
DROP TABLE IF EXISTS "evaluatedProjects";
backend/src/database/migrations/V1778749030__refactor-projects-catalog.sql:6
- This migration drops projectCatalog.ossfCriticalityScore, but it is still referenced by ingestion/upsert code (e.g. services/apps/automatic_projects_discovery_worker/... and services/libs/data-access-layer/src/project-catalog/*). Without updating those call sites (and possibly the projectCatalog column list/types), deploys will start failing with "column does not exist" errors.
-- Remove ossfCriticalityScore from projectCatalog
ALTER TABLE "projectCatalog" DROP COLUMN IF EXISTS "ossfCriticalityScore";
DROP INDEX IF EXISTS "ix_projectCatalog_ossfCriticalityScore";
backend/src/database/migrations/V1778749030__refactor-projects-catalog.sql:16
- This migration uses IF EXISTS/IF NOT EXISTS for DROP/ADD COLUMN, but the new CREATE INDEX statements are not guarded. If the migration is re-run or partially applied in any environment, CREATE INDEX will error out. Consider using CREATE INDEX IF NOT EXISTS (and/or CONCURRENTLY if this table can be large) for consistency and safer replays.
CREATE INDEX "ix_projectCatalog_source" ON "projectCatalog" ("source");
CREATE INDEX "ix_projectCatalog_action" ON "projectCatalog" ("action");
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
637047e to
db4a8f4
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit db4a8f4. Configure here.

Note
High Risk
High risk because it drops the
evaluatedProjectstable and removes theossfCriticalityScorecolumn/index, which can cause irreversible data loss and break any code or queries still depending on them.Overview
This migration removes legacy project evaluation storage by dropping the
evaluatedProjectstable and deleting theprojectCatalog.ossfCriticalityScorecolumn (and its index).It extends
projectCatalogwith new metadata fields (source,action,evaluatedAt,onboardedAt) and adds indexes onsourceandactionto support the updated querying model.Reviewed by Cursor Bugbot for commit db4a8f4. Bugbot is set up for automated code reviews on this repo. Configure here.