#!/bin/sh set -e # 数据库文件路径(可根据实际环境调整) DB_FILE=./database/db.sqlite3 # 如果数据库文件不存在,先 migrate 再 seed if [ ! -f "$DB_FILE" ]; then echo "Database not found, running migration and seed..." bun run npx knex migrate:latest bun run npx knex seed:run else echo "Database exists, running migration only..." bun run npx knex migrate:latest fi # 启动主服务 exec bun src/main.js