Skip to content

Instantly share code, notes, and snippets.

@potikanond
Last active October 2, 2024 14:28
Show Gist options
  • Save potikanond/ac536b98821696f816429db7bf8d6201 to your computer and use it in GitHub Desktop.
Save potikanond/ac536b98821696f816429db7bf8d6201 to your computer and use it in GitHub Desktop.
261207 - Lecture 21 - Prisma schema sample for MongoDB
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mongodb"
url = env("DATABASE_URL")
}
// define Course model
model Course {
// id is mapped to _id and managed by mongodb
id String @id @default(auto()) @map("_id") @db.ObjectId
courseNo String @unique
title String @unique
// collection name
@@map("courses")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment