Files
pos-system/scripts/db/seed.sh
Ho Ngoc Hai 29c40ea681 Update project documentation and scripts for improved setup and bilingual support
- Enhanced `README.md` with a quick start guide and detailed project structure.
- Updated `SETUP_GUIDE.md` by removing it as it was redundant.
- Improved `local-development.md` and `development.md` with clearer instructions for database migrations.
- Added bilingual comments in various scripts for better understanding and usability.
- Updated `.gitignore` to include specific build scripts while ignoring others.
- Enhanced `scripts` for database management, including backup and seeding functionalities with bilingual support.
2025-12-27 10:12:46 +07:00

42 lines
954 B
Bash
Executable File

#!/bin/bash
set -e
SERVICE=$1
# EN: Validate argument
# VI: Xác thực tham số
if [ -z "$SERVICE" ]; then
echo "Usage: $0 <service-name>"
echo "Example: $0 auth-service"
exit 1
fi
# EN: Check if service exists
# VI: Kiểm tra xem service có tồn tại không
if [ ! -d "services/$SERVICE" ]; then
echo "❌ Service $SERVICE not found"
exit 1
fi
echo "🌱 Seeding database for $SERVICE..."
cd "services/$SERVICE"
# EN: Check if DATABASE_URL is set
# VI: Kiểm tra DATABASE_URL đã được thiết lập chưa
if [ -z "$DATABASE_URL" ]; then
if [ -f ".env" ]; then
export $(grep -v '^#' .env | xargs)
elif [ -f "../../deployments/local/.env.local" ]; then
export $(grep -v '^#' ../../deployments/local/.env.local | xargs)
else
echo "⚠️ DATABASE_URL not set. Please set it in .env or environment variable."
exit 1
fi
fi
pnpm prisma:seed
echo "✅ Database seeded!"