Skip to content

feat: migrations for community collections#3883

Open
gaspergrom wants to merge 1 commit intomainfrom
feat/community-collections-migrations
Open

feat: migrations for community collections#3883
gaspergrom wants to merge 1 commit intomainfrom
feat/community-collections-migrations

Conversation

@gaspergrom
Copy link
Contributor

@gaspergrom gaspergrom commented Mar 2, 2026

Note

Medium Risk
Medium risk because it introduces new tables and foreign keys and alters collections, which can impact existing data/migrations and query expectations if not deployed in the right order.

Overview
Introduces new DB migrations for community collections: adds isPrivate, ssoUserId, and logoUrl columns to collections, creates insightsSsoUsers, and wires a FK from collections.ssoUserId with ON DELETE SET NULL.

Adds join/interaction tables collectionsRepositories (with soft-delete and an index on active rows) and collectionLikes (soft-delete plus a partial unique index to enforce one active like per user/collection), and provides a down migration that drops these tables/columns/constraint.

Updates the data-access-layer collections types/enums to include isPrivate, ssoUserId, and logoUrl as queryable fields.

Written by Cursor Bugbot for commit 6bc38d8. This will update automatically on new commits. Configure here.

Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
@gaspergrom gaspergrom self-assigned this Mar 2, 2026
@gaspergrom gaspergrom requested a review from joanagmaia March 2, 2026 11:46
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

2 similar comments
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

starred: boolean
isPrivate?: boolean
ssoUserId?: string | null
logoUrl?: string | null
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createCollection SQL ignores new columns

High Severity

The ICreateCollection interface now accepts isPrivate, ssoUserId, and logoUrl, and the migration adds these columns to the database, but the createCollection function's hardcoded INSERT statement on line 139 only includes name, description, slug, categoryId, starred. Any values passed for the new fields will be silently dropped, so community collections can never be created with the correct ssoUserId or isPrivate flag.

Additional Locations (1)

Fix in Cursor Fix in Web


CREATE INDEX "ix_collectionsRepositories_collectionId"
ON public."collectionsRepositories" ("collectionId")
WHERE "deletedAt" IS NULL;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing unique index on collectionsRepositories for active records

Medium Severity

The collectionsRepositories table lacks a partial unique index on (collectionId, repoId) WHERE deletedAt IS NULL, unlike the collectionLikes table which correctly has one on (collectionId, ssoUserId). Without this constraint, the same repository can be actively linked to the same collection multiple times, leading to duplicate data.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants