You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The persistence model is increasingly relational, while the current MongoDB/Mongoose schema relies on embedded arrays, duplicated relationships, and application-side joins/aggregation.
Examples:
contests embed participants and problem references
profiles duplicate follower/following relationships across documents
coin balances embed and cap transaction history
leaderboard loads all submissions/problems into application memory
notes are globally unique per problem instead of scoped per user
ownership, uniqueness, and referential rules are mostly application-enforced
MongoDB remains suitable for document-shaped data such as problem test cases and playground files, but PostgreSQL can retain those fields as jsonb while enforcing relational integrity elsewhere.
Proposal
Migrate to PostgreSQL with Drizzle ORM and Drizzle Kit migrations.
Problem
The persistence model is increasingly relational, while the current MongoDB/Mongoose schema relies on embedded arrays, duplicated relationships, and application-side joins/aggregation.
Examples:
MongoDB remains suitable for document-shaped data such as problem test cases and playground files, but PostgreSQL can retain those fields as
jsonbwhile enforcing relational integrity elsewhere.Proposal
Migrate to PostgreSQL with Drizzle ORM and Drizzle Kit migrations.
Suggested tables:
problemssubmissionsbookmarks— unique(user_id, problem_id)notes— unique(user_id, problem_id)commentsprofilesfollows— unique(follower_id, followed_id)contestscontest_problemscontest_participants— unique(contest_id, user_id)coin_transactionsuser_balancesblogsplayground_snippetsgithub_integrationsuser_rolesUse
jsonbor arrays only for genuinely document-shaped values, including problem examples/test cases and playground files/test cases.Work
Acceptance criteria