数据库
数据库部分是用的 postgresql
数据库,下面是项目用到的表结构:
auth.js
auth.js 部分的表,是 Auth.js 库所需要依赖的表。
其中包含了:users
、accounts
、sessions
、verification_tokens
四张表。
prisma
_prisma_migrations
表是 prisma 进行 migrate 需要的表,建议不要擅自修改!
系统业务表
- 图片表 (images)
字段名 | 类型 | NOT NULL | 默认值 | 说明 |
---|---|---|---|---|
id | varchar(50) | yes | 主键ID(使用cuid生成) | |
url | text | no | 原始图片存储地址 | |
preview_url | text | no | 缩略图预览地址 | |
video_url | text | no | LivePhoto关联视频地址 | |
exif | json | no | EXIF元数据(JSON格式存储) | |
labels | json | no | 图片索引标签 | |
width | int4 | yes | 0 | 图片像素宽度 |
height | int4 | yes | 0 | 图片像素高度 |
lon | text | no | 图片拍摄经度 | |
lat | text | no | 图片拍摄纬度 | |
title | varchar(200) | no | 图片展示标题 | |
detail | text | no | 详细描述内容 | |
type | int2 | yes | 1 | 类型:1->普通图片;2->livephoto |
show | int2 | yes | 1 | 显示状态:0=显示,1=隐藏 |
show_on_mainpage | int2 | yes | 1 | 首页显示状态:0=显示,1=隐藏 |
sort | int2 | yes | 0 | 排序 |
created_at | timestamp | yes | CURRENT_TIMESTAMP | 记录创建时间 |
updated_at | timestamp | no | 最后更新时间 | |
del | int2 | yes | 0 | 删除标记:0=正常,1=已删除 |
- 配置表(configs)
字段名 | 类型 | NOT NULL | 默认值 | 说明 |
---|---|---|---|---|
id | varchar(50) | yes | 主键ID(使用cuid生成) | |
config_key | varchar(200) | yes | ||
config_value | text | no | ||
detail | text | no | 说明 | |
created_at | timestamp | yes | CURRENT_TIMESTAMP | 记录创建时间 |
updated_at | timestamp | no | 最后更新时间 |
- 相册表(albums)
字段名 | 类型 | NOT NULL | 默认值 | 说明 |
---|---|---|---|---|
id | varchar(50) | yes | 主键ID(使用cuid生成) | |
name | varchar(200) | yes | 相册名称 | |
album_value | text | yes | 相册路由 | |
detail | text | no | 相册详情 | |
show | int2 | yes | 1 | 显示状态:0=显示,1=隐藏 |
sort | int2 | yes | 0 | 排序 |
license | int2 | no | 许可协议 | |
image_sorting | int2 | yes | 1 | 相册排序规则:1=上传时间从新到旧,2=拍摄时间从新到旧,3=上传时间从旧到新,4=拍摄时间从旧到新 |
random_show | int2 | yes | 1 | 随机排序:0=开启,1=关闭 |
created_at | timestamp | yes | CURRENT_TIMESTAMP | 记录创建时间 |
updated_at | timestamp | no | 最后更新时间 | |
del | int2 | yes | 0 | 删除标记:0=正常,1=已删除 |
- 图片相册关联表(images_albums_relation)
字段名 | 类型 | NOT NULL | 默认值 | 说明 |
---|---|---|---|---|
album_value | text | yes | 相册路由 | |
imageId | varchar(50) | yes | 图片表id |