Files
pos-system/scripts/db/seed.sh
Ho Ngoc Hai 019c79b898 Refactor auth-service to iam-service and update related configurations
- Renamed auth-service to iam-service across various files for consistency.
- Updated deployment workflows, database migration scripts, and documentation to reflect the service name change.
- Enhanced bilingual documentation for clarity on the new service structure and usage.
- Removed outdated references to auth-service in scripts and configuration files to streamline the project structure.
2025-12-30 21:03:00 +07:00

42 lines
953 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 iam-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!"