-
Notifications
You must be signed in to change notification settings - Fork 10.2k
fix: Hotfix missing schema, out of sync with migrations #22977
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
Conversation
WalkthroughThe changes update the Prisma schema by modifying the Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Note 🔌 MCP (Model Context Protocol) integration is now available in Early Access!Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context. ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Graphite Automations"Add foundation team as reviewer" took an action on this PR • (08/08/25)1 reviewer was added to this PR based on Keith Williams's automation. |
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/prisma/schema.prisma (2)
656-656
: Back-relation on Membership added
Host Host[]
provides the reverse navigation and matches the pattern already present (e.g.,Schedule.Host
). If you anticipate another relation between Membership and Host in the future, consider naming the relation explicitly on both sides to avoid ambiguity, otherwise this is fine to keep implicit.
66-71
: Confirm cascade delete and composite index necessity– We ran a search across the codebase and found no queries that filter on both
memberId
andeventTypeId
; a composite index is only needed if you start using that pattern.
– The migration addingHost.memberId
and its foreign-key constraint is present; please verify that it includesON DELETE CASCADE
and that deleting aMembership
should indeed purge its associatedHost
records.
– There’s no DB-level guarantee thatHost.userId
==Membership.userId
; if that invariant is important, enforce it in your application or service layer.
– When readingHost.member
, continue to prefer explicit Prismaselect
overinclude
.Optional composite index if you start filtering by both columns:
model Host { @@id([userId, eventTypeId]) @@index([memberId]) + @@index([memberId, eventTypeId], name: "Host_memberId_eventTypeId_idx") @@index([userId]) @@index([eventTypeId]) @@index([scheduleId]) }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/prisma/schema.prisma
(2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: Udit-takkar
PR: calcom/cal.com#22919
File: packages/lib/server/repository/PrismaPhoneNumberRepository.ts:412-417
Timestamp: 2025-08-07T18:42:34.056Z
Learning: In Cal.com codebase, the coding guideline requiring explicit `select` clauses instead of `include` for Prisma queries applies to read operations but not to update operations. Update operations don't need explicit select clauses.
Learnt from: sean-brydon
PR: calcom/cal.com#22618
File: packages/trpc/server/routers/viewer/eventTypes/utils/transformUtils.ts:113-113
Timestamp: 2025-08-05T07:42:06.335Z
Learning: In Cal.com's getUserEventGroups handler refactor (PR #22618), the membershipCount field for team event groups is intentionally set to 0 in the new createTeamEventGroup function, as confirmed by sean-brydon (PR author). This preserves the same behavior as the old implementation that was being refactored, maintaining backward compatibility. While other parts of the codebase may use actual member counts, this specific implementation maintains the previous behavior.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Install dependencies / Yarn install & cache
🔇 Additional comments (1)
packages/prisma/schema.prisma (1)
66-68
: LGTM: Host ↔ Membership relation and index align the schema with migrationsAdding
memberId
, themember
relation withonDelete: Cascade
, and@@index([memberId])
looks correct and consistent with existing cascade behavior on other Host relations. This should resolve the drift and restore proper client typings.Also applies to: 70-70
E2E results are ready! |
What does this PR do?
Applied a migration without committing schema.