Files
telegram-shop/admin-next/.zscripts/database-runtime-build.sh
NW a4a5fd449d feat(admin): integrate Next.js admin panel (admin-next/) from feat/nextjs-admin
- Add admin-next/: full Next.js + Prisma + shadcn admin panel (45 API routes, 76 components)
- docker-compose: tg_shop_admin service (port 3000, shared db/shop.db, prisma), bot talks to it via ADMIN_CHAT_URL=http://tg_shop_admin:3000/api/chat
- tor-proxy now proxies onion admin to tg_shop_admin:3000 (new panel)
- chatbotService: ADMIN_CHAT_URL default = http://tg_shop_admin:3000/api/chat (removed localhost:3100 anachronism)
- .env admin secrets gitignored (admin-next/.env)
2026-08-08 01:31:45 +01:00

34 lines
901 B
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
set -euo pipefail
PROJECT_DIR="${PROJECT_DIR:-/home/z/my-project}"
BUILD_DIR="${BUILD_DIR:?BUILD_DIR is required}"
SOURCE_DB_DIR="$PROJECT_DIR/db"
SOURCE_DB_PATH="$SOURCE_DB_DIR/custom.db"
TARGET_DB_DIR="$BUILD_DIR/db"
TARGET_DB_PATH="$TARGET_DB_DIR/custom.db"
mkdir -p "$TARGET_DB_DIR"
if [ -f "$SOURCE_DB_PATH" ]; then
echo "🗄️ 复制 Preview 数据库到构建产物..."
cp -a "$SOURCE_DB_DIR/." "$TARGET_DB_DIR/"
else
echo " 未找到 Preview 数据库 db/custom.db将初始化空的生产数据库"
fi
echo "🗄️ 同步构建产物中的数据库结构..."
(
cd "$PROJECT_DIR"
DATABASE_URL="file:$TARGET_DB_PATH" bun run db:push
)
if [ ! -f "$TARGET_DB_PATH" ]; then
echo "❌ 数据库初始化命令执行成功,但未生成 $TARGET_DB_PATH"
exit 1
fi
echo "✅ 构建产物数据库已准备完成"
ls -lah "$TARGET_DB_DIR"