数据库找不到表
tsThe table `public.SiteSetting` does not exist in the current database.
prisma:error
Invalid `prisma.friendLink.findMany()` invocation:
解决(单镜像)
输入
- 强制重置数据库(清空脏数据+删除错误迁移记录)
npx prisma migrate reset --force - 生成全新迁移,自动创建所有表(SiteSetting/CustomPage等)
npx prisma migrate dev --name init
就能跑起来了
问题?
如果我做zeabur模板
多镜像完整3个加2个数据库
ts# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
name: Rhex
spec:
description: Open Source Modern Community Software built with Next.js
coverImage: https://github.com/lovedevpanda/Rhex/raw/main/docs/preview/home-overview.png
icon: https://rhex.im/icon.svg
variables:
- key: PUBLIC_DOMAIN
type: DOMAIN
name: Domain
description: Domain of your Rhex community app
- key: PASSWORD
type: STRING
name: Admin & DB Password
description: Password for the admin account and database
tags:
- Community
- Forum
- Open Source
- Next.js
- PostgreSQL
- Redis
readme: |
Rhex is an open-source modern community software.
Official Site: https://rhex.im/
GitHub: https://github.com/lovedevpanda/Rhex
Template Author: liseezn | Homepage: https://liseezn.top/
## Features
Post, Comment, Notification, Addon System, File Upload, and full community capabilities.
Auto-create admin account on first deployment (ignored if admin exists).
## App Structure
- PostgreSQL: Database
- Redis: Cache & Queue
- Setup: Initialization & Seeding
- Web: Main Frontend & Backend Service
- Worker: Background Task Worker
- Nginx: Unified Gateway
## Deployment
Click Deploy, fill the domain, and all services will start automatically.
volumes:
uploads:
type: SHARED
addons:
type: SHARED
services:
# Nginx Gateway
- name: nginx
icon: https://www.svgrepo.com/show/373924/nginx.svg
dependencies:
- web
template: PREBUILT_V2
domainKey: PUBLIC_DOMAIN
spec:
id: nginx
source:
image: nginx:1.27
ports:
- id: web
port: 80
type: HTTP
configs:
- path: /etc/nginx/nginx.conf
template: |
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events { worker_connections 1024; }
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
client_max_body_size 100M;
include /etc/nginx/conf.d/*.conf;
}
permission: null
envsubst: null
- path: /etc/nginx/conf.d/default.conf
template: |
server {
listen 80;
server_name _;
location / {
proxy_pass http://web:3000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
permission: null
envsubst: null
# PostgreSQL Database
- name: postgres
icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/postgresql.svg
template: PREBUILT_V2
spec:
id: postgres
source:
image: postgres:latest
ports:
- id: database
port: 5432
type: TCP
volumes:
- id: data
dir: /var/lib/postgresql
env:
POSTGRES_DB:
default: bbs
expose: true
POSTGRES_USER:
default: postgres
expose: true
POSTGRES_PASSWORD:
default: ${PASSWORD}
expose: true
PGDATA:
default: /var/lib/postgresql/data/pgdata
TZ:
default: Asia/Shanghai
POSTGRES_HOST:
default: ${CONTAINER_HOSTNAME}
expose: true
POSTGRES_PORT:
default: ${DATABASE_PORT}
expose: true
# Redis Cache
- name: redis
icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/redis.svg
template: PREBUILT_V2
spec:
id: redis
source:
image: redis:latest
command: ["redis-server", "--appendonly", "yes"]
ports:
- id: database
port: 6379
type: TCP
volumes:
- id: data
dir: /data
env:
REDIS_HOST:
default: ${CONTAINER_HOSTNAME}
expose: true
REDIS_PORT:
default: ${DATABASE_PORT}
expose: true
# Setup Initialization Service (with automatic retry & forced migration)
- name: setup
icon: https://rhex.im/icon.svg
dependencies:
- postgres
- redis
template: PREBUILT_V2
spec:
id: setup
source:
image: ghcr.io/lovedevpanda/rhex:latest
volumes:
- id: uploads
dir: /app/uploads
- id: addons
dir: /app/addons
command: ["sh", "-c", "until pnpm exec prisma migrate reset --force --skip-seed && pnpm exec prisma migrate dev --name init; do echo 'Retry in 5s...'; sleep 5; done && pnpm run setup:prod && sleep infinity"]
env:
DATABASE_URL:
default: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}?schema=public
expose: true
REDIS_URL:
default: redis://${REDIS_HOST}:${REDIS_PORT}
expose: true
SEED_ADMIN_USERNAME:
default: admin
expose: true
SEED_ADMIN_PASSWORD:
default: ${PASSWORD}
expose: true
SEED_ADMIN_EMAIL:
default: admin@rhex.im
expose: true
SEED_ADMIN_NICKNAME:
default: Community Admin
expose: true
TZ:
default: Asia/Shanghai
# Web Main Service
- name: web
icon: https://rhex.im/icon.svg
dependencies:
- postgres
- redis
- setup
template: PREBUILT_V2
spec:
id: web
source:
image: ghcr.io/lovedevpanda/rhex:latest
ports:
- id: web
port: 3000
type: HTTP
volumes:
- id: uploads
dir: /app/uploads
- id: addons
dir: /app/addons
command: ["pnpm", "run", "start"]
env:
DATABASE_URL:
default: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}?schema=public
expose: true
REDIS_URL:
default: redis://${REDIS_HOST}:${REDIS_PORT}
expose: true
HOSTNAME:
default: 0.0.0.0
PORT:
default: "3000"
TZ:
default: Asia/Shanghai
# Worker Service
- name: worker
icon: https://rhex.im/icon.svg
dependencies:
- postgres
- redis
- setup
template: PREBUILT_V2
spec:
id: worker
source:
image: ghcr.io/lovedevpanda/rhex:latest
volumes:
- id: uploads
dir: /app/uploads
- id: addons
dir: /app/addons
command: ["pnpm", "run", "worker"]
env:
DATABASE_URL:
default: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}?schema=public
expose: true
REDIS_URL:
default: redis://${REDIS_HOST}:${REDIS_PORT}
expose: true
TZ:
default: Asia/Shanghai
# 全语言本地化 已加入模板作者信息
localization:
en:
description: Open Source Modern Community Software built with Next.js
readme: |
Rhex is an open-source modern community software.
Official Site: https://rhex.im/
GitHub: https://github.com/lovedevpanda/Rhex
Template Author: liseezn | Homepage: https://liseezn.top/
## Features
Post, Comment, Notification, Addon System, File Upload, and full community capabilities.
Auto-create admin account on first deployment (ignored if admin exists).
es:
description: Software de comunidad moderno de código abierto construido con Next.js
readme: |
Rhex es un software de comunidad moderno de código abierto.
Sitio oficial: https://rhex.im/
GitHub: https://github.com/lovedevpanda/Rhex
Autor de plantilla: liseezn | Página principal: https://liseezn.top/
## Características
Publicaciones, comentarios, notificaciones, sistema de complementos, carga de archivos y capacidades completas de comunidad.
Crea automáticamente una cuenta de administrador en la primera implementación (se ignora si el administrador existe).
id:
description: Perangkat Lunak Komunitas Modern Sumber Terbuka yang dibangun dengan Next.js
readme: |
Rhex adalah perangkat lunak komunitas modern sumber terbuka.
Situs Resmi: https://rhex.im/
GitHub: https://github.com/lovedevpanda/Rhex
Penulis Template: liseezn | Halaman Utama: https://liseezn.top/
## Fitur
Posting, Komentar, Notifikasi, Sistem Addon, Unggah File, dan kemampuan komunitas lengkap.
Buat akun admin secara otomatis pada penyebaran pertama (diabaikan jika admin sudah ada).
ja-JP:
description: Next.js で構築されたオープンソースのモダンコミュニティソフトウェア
readme: |
Rhex はオープンソースのモダンコミュニティソフトウェアです。
公式サイト: https://rhex.im/
GitHub: https://github.com/lovedevpanda/Rhex
テンプレート作者: liseezn | ホームページ: https://liseezn.top/
## 機能
投稿、コメント、通知、アドオンシステム、ファイルアップロード、完全なコミュニティ機能を備えています。
最初のデプロイ時に管理者アカウントを自動作成(管理者が存在する場合は無視されます)。
zh-CN:
description: 基于 Next.js 构建的开源现代化社区系统
readme: |
Rhex 是一款开源现代化社区系统。
官方网站:https://rhex.im/
开源仓库:https://github.com/lovedevpanda/Rhex
模板作者:liseezn 主页:https://liseezn.top/
## 功能介绍
支持发帖、评论、消息通知、插件扩展、文件上传等完整社区能力。
首次部署自动创建管理员账号(已存在则自动忽略)。
## 应用架构
- PostgreSQL:数据库
- Redis:缓存与队列
- Setup:初始化服务
- Web:主服务
- Worker:后台任务服务
- Nginx:统一网关
zh-TW:
description: 基於 Next.js 建構的開源現代化社群系統
readme: |
Rhex 是一款開源現代化社群系統。
官方網站:https://rhex.im/
開源倉庫:https://github.com/lovedevpanda/Rhex
模板作者:liseezn 主頁:https://liseezn.top/
## 功能介紹
支援發文、留言、訊息通知、外掛擴展、檔案上傳等完整社群能力。
首次部署自動建立管理員帳號(已存在則自動忽略)。
## 應用架構
- PostgreSQL:資料庫
- Redis:快取與佇列
- Setup:初始化服務
- Web:主服務
- Worker:背景任務服務
- Nginx:統一閘道
就解决不了上述问题
www.liseezn.top www.wewe.men
日志
Invalid `prisma.siteSetting.findFirst()` invocation: The table `public.SiteSetting` does not exist in the current database. prisma:error Invalid `prisma.siteSetting.findFirst()` invocation: The table `public.SiteSetting` does not exist in the current database. prisma:error Invalid `prisma.customPage.findMany()` invocation: The table `public.CustomPage` does not exist in the current database. ⨯ Error [PrismaClientKnownRequestError]: Invalid `prisma.customPage.findMany()` invocation: The table `public.CustomPage` does not exist in the current database. at async g (.next/server/chunks/ssr/[root-of-the-server]__0kl3cfu._.js:1:4613) at async Z (.next/server/chunks/ssr/[root-of-the-server]__0_inswb._.js:15:516) { code: 'P2021', meta: { modelName: 'CustomPage', table: 'public.CustomPage' }, clientVersion: '6.19.2', digest: '995097739' } prisma:error Invalid `prisma.siteSetting.findFirst()` invocation: The table `public.SiteSetting` does not exist in the current database. ⨯ Error [PrismaClientKnownRequestError]: Invalid `prisma.siteSetting.findFirst()` invocation: The table `public.SiteSetting` does not exist in the current database. at async K (.next/server/chunks/ssr/_04lgrw~._.js:225:360090) at async (.next/server/chunks/ssr/_04lgrw~._.js:8:30263) at async P (.next/server/chunks/ssr/_04lgrw~._.js:225:386482) at async Q (.next/server/chunks/ssr/_04lgrw~._.js:225:386956) at async Module.Y [as generateMetadata] (.next/server/chunks/ssr/[root-of-the-server]__0_inswb._.js:15:33) { code: 'P2021', meta: { modelName: 'SiteSetting', table: 'public.SiteSetting' }, clientVersion: '6.19.2', digest: '907543524' }