medicine/Medicine-Server/uploadRes/prisma/schema.prisma

89 lines
2.8 KiB
Plaintext

// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
// 分类表
model x_category {
id Int @id @default(autoincrement())
name String @default("") // 栏目名称
sort Int @default(0) // 排序
status Int @default(1) // 状态 1正常 0禁用
thumb String @default("") // 栏目缩略图
desc String @default("") // 栏目描述
new_bg String @default("") // 新品背景图s
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
// 关联
goods x_goods[] // 关联到该分类的商品列表
}
// 商品表
model x_goods {
id Int @id @default(autoincrement())
name String @default("") // 商品名称
// 基本介绍
common_name String? @default("") // 通用名
weight String? @default("") // 含量
type String? @default("") // 剂型
goods_no String? @default("") // 登记号
desc String? @db.Text // 特性
ident String? @default("") // 标识
spec String? @default("") // 规格
label String? @default("") //产品标签
label_color String? @default("") //标签颜色
content String? @db.Text // 卖点
thumb String? @db.Text // 商品缩略图
images String? @db.Text // 商品相册
posters String? @db.Text // 宣传海报
new Int @default(0) // 是否新品 0否 1是
use_data String? @db.Text // 使用方法,用 json
explain String? @db.Text // 使用说明
status Int @default(1) // 状态 1正常 0禁用
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
// 关联分类
category x_category @relation(fields: [categoryId], references: [id])
categoryId Int
}
// 角色表
model x_role {
id Int @id @default(autoincrement())
name String @unique
desc String
status Int @default(1) // 状态 1正常 0禁用
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
x_user x_user[]
}
// 用户表
model x_user {
id Int @id @default(autoincrement())
username String @unique
password String?
nickname String?
avatar String?
status Int @default(1) // 状态 1正常 0禁用
// 角色
role x_role @relation(fields: [roleId], references: [id])
roleId Int
isDelete Int @default(0) // 是否删除 0未删除 1已删除
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
// 系统设置
model x_config {
id Int @id @default(autoincrement())
bannerImg String @default("")
}