Skip to content

Add custom schema1#28545

Open
OKBoomer88 wants to merge 1 commit intocalcom:mainfrom
OKBoomer88:dev/schema_update1
Open

Add custom schema1#28545
OKBoomer88 wants to merge 1 commit intocalcom:mainfrom
OKBoomer88:dev/schema_update1

Conversation

@OKBoomer88
Copy link

@OKBoomer88 OKBoomer88 commented Mar 23, 2026

Custom database schema


Summary by cubic

Adds Business and Service models to the Prisma schema and links Booking and User to a business to support per-business service menus and notification settings.

  • New Features

    • Business model with status, contact fields, notification toggles, unique slug, timestamps, and index on lineUserId.
    • Service model linked to a business with name/description, price, duration, image, isActive, category; unique per-business name and indexed by businessId.
    • Optional Booking.businessId FK to Business (SET NULL on delete).
    • Optional User.primaryBusinessId FK to Business with a unique constraint.
  • Migration

    • Run Prisma migrations in packages/prisma (e.g., prisma migrate deploy).
    • Backfill: create Business records, set User.primaryBusinessId and Booking.businessId where applicable.
    • Ensure uniqueness: Business.slug; Service name per business; only one User can reference a given Business as primary.

Written for commit a7d098f. Summary will update on new commits.

@OKBoomer88 OKBoomer88 requested a review from a team as a code owner March 23, 2026 00:36
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions bot added the ❗️ migrations contains migration files label Mar 23, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 23, 2026

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "Add custom schema1". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/prisma/schema.prisma">

<violation number="1" location="packages/prisma/schema.prisma:975">
P2: New `Booking.businessId` foreign key is missing an explicit index, risking slower business-based lookups/joins and FK maintenance scans on PostgreSQL.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

report BookingReport?

//OKBOOMER: business linkage
businessId Int?
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 23, 2026

Choose a reason for hiding this comment

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

P2: New Booking.businessId foreign key is missing an explicit index, risking slower business-based lookups/joins and FK maintenance scans on PostgreSQL.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/prisma/schema.prisma, line 975:

<comment>New `Booking.businessId` foreign key is missing an explicit index, risking slower business-based lookups/joins and FK maintenance scans on PostgreSQL.</comment>

<file context>
@@ -899,6 +971,10 @@ model Booking {
   report                       BookingReport?
 
+  //OKBOOMER: business linkage
+  businessId Int?
+  business   Business? @relation("BusinessBookings", fields: [businessId], references: [id])
+
</file context>
Fix with Cubic

Copy link
Contributor

@Ryukemeister Ryukemeister left a comment

Choose a reason for hiding this comment

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

hey there, thank you for contribution. can you please link the github issue this fixes. also curious, what exactly is the benefit of this?

Adds Business and Service models to the Prisma schema and links Booking and User to a business to support per-business service menus and notification settings.

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

Labels

❗️ migrations contains migration files size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants