Created by CyanHall.com
on 07/05/2021
πΒ Β Star me if itβs helpful.
πΒ Β Star me if itβs helpful.
1. prisma/$DB_TYPE/schema.prisma
// Hightlight .prisma file using VS Code Extension:
// https://marketplace.visualstudio.com/items?itemName=Prisma.prisma
// Docs: https://pris.ly/d/prisma-schema
datasource db {
provider = "postgresql"
url = env("DB_URL") // using DB_URL in .env file, only one url should be provided.
url = "postgresql://[user]:[password]@localhost:5432/[db_name]?schema=public"
url = "mysql://[user]:[password]@localhost:5432/[db_name]?connection_limit=5"
url = "file:./db.sqlite"
}
// for JavaScript
generator client {
provider = "prisma-client-js"
}
// for Golang
generator db {
provider = "go run github.com/prisma/prisma-client-go"
// set the output folder and package name
// output = "./your-folder"
// package = "yourpackagename"
}
model User {
id Int @id @default(autoincrement())
email String @unique @default("")
title String @db.VarChar(255)
content String?
valid Boolean @default(true)
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @default(now()) @map(name: "updated_at") // column name
@@map(name: "users") // Table name
}
More