CAFECA-IO / KnowledgeManagement

Creating, Sharing, Using and Managing the knowledge and information of CAFECA
https://mermer.com.tw/knowledge-management
MIT License
0 stars 1 forks source link

create mongo db of the website #101

Open YangIsCoding opened 4 months ago

YangIsCoding commented 4 months ago

create mongo db of the website

YangIsCoding commented 4 months ago

complete database but instead of using mongo, it's completed with prisma

YangIsCoding commented 4 months ago

using 5 hrs

YangIsCoding commented 4 months ago
// 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     = "mysql"
  url          = env("DATABASE_URL")
  relationMode = "prisma"
}

model ContactForm {
  id          Int      @id @default(autoincrement())
  name        String
  email       String
  phoneNumber String?
  message     String
  createdAt   DateTime @default(now())
}

model post {
  id       Int     @id @unique @default(autoincrement())
  userId    Int      
  title     String
  content      String
  shortdesc  String
  postTime  String
  postImg   String
  user      user    @relation(fields: [userId], references: [userId])
}

model user {
  userId      Int     @id @unique @default(autoincrement())
  userName    String
  userImg     String
  posts       post[]
}