hey <@U02BS9YFFL7>, <@U04D3GK43FS> would love to ...
# developers
p
hey @zomars, @Fernando Sánchez would love to help implement a MySQL adapter for prisma
z
For prisma? I think I’m not following. Prisma already had mysql support
f
Hi @zomars , let m explain it to you! We are making an integration with Calcom into our system for scheduling meetings for our clients. Unfortunately, there is no support for mysql. What I'm trying to say is that we want adapt the prisma schema to mysql so we can use the application in a mysql database.
z
As far as I know there's no need to adapt the prisma schema since it's supposed to support MySQL out of the box. For your use case you would simply need to delete all migrations files (which are made for postgresql) and reinitialize with mysql. The only lines you would need to change to the schema (in theory) are these:
f
Ok Zomars, we are going to have a look at it
Hi @zomars, we are trying to change the provider to mysql. We have deleted all the migrations as you said. The problem is that mysql doesn't support the primitive types. The "yarn" command throws a lot of errors from this type. here it is one example:
Copy code
model Booking {
  id                    Int                  @id @default(autoincrement())
  uid                   String               @unique
  user                  User?                @relation(fields: [userId], references: [id])
  userId                Int?
  references            BookingReference[]
  eventType             EventType?           @relation(fields: [eventTypeId], references: [id])
  eventTypeId           Int?
  title                 String
  description           String?
  customInputs          Json?
  startTime             DateTime
  endTime               DateTime
  attendees             Attendee[]
  location              String?
  createdAt             DateTime             @default(now())
  updatedAt             DateTime?
  status                BookingStatus        @default(ACCEPTED)
  paid                  Boolean              @default(false)
  payment               Payment[]
  destinationCalendar   DestinationCalendar? @relation(fields: [destinationCalendarId], references: [id])
  destinationCalendarId Int?
  cancellationReason    String?
  rejectionReason       String?
  dynamicEventSlugRef   String?
  dynamicGroupSlugRef   String?
  rescheduled           Boolean?
  fromReschedule        String?
  recurringEventId      String?
  smsReminderNumber     String?
  workflowReminders     WorkflowReminder[]
  scheduledJobs         String[]
}
error: Field "scheduledJobs" in model "Booking" can't be a list. The current connector does not support lists of primitive types. We are thinking to change this kind of fields to a Json field. Example: From this:
Copy code
scheduledJobs         String[]
to:
Copy code
scheduledJobs         String?  @db.Text
or
Copy code
scheduledJobs         Json?
Let me know your thoughts
z
You can try that for sure
f
Hi @zomars, we have advanced a lot in the mysql migration. Unfortunately, we are having the following issue related to the Availability table. Field "days" in model "Availability" can't be a list. The current connector does not support lists of primitive types. --> schema.prisma:88 | 87 | eventTypeId Int? 88 | days Int[] 89 | date DateTime? @db.DateTime(0)
z
Can you make this a json field as well?
f
Hi @zomars we did it and it worked. We have advanced a lot in the integration to mysql. We have almost finished, but we are having an error while we create a Booking for an event. It's related to the eventTriggers field in Webhook Model. Before, it was expecting an array from the enum WebHookTriggerEvents, but now we have changed it to Json. We have passed that file to another file so we can access from outside the prisma and now JsonFilter cannot get the webhooktriggerevent