CyanHall.com 创建于 2021-07-05
👉  github shields 如果有用请点赞。

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
}
  

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
}
  


Maitained by Cyanhall.com, Copy Rights @ CC BY-NC-SA 4.0     ExcelRoadMap