mirror of
https://git.meshkee.com/Meshkee/backend.git
synced 2026-08-11 22:30:59 +04:30
NestJS backend with Prisma, Docker Compose for Postgres/Redis, and deploy docs for the production VM.
28 lines
623 B
Bash
Executable File
28 lines
623 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
SEEDS_DIR="$ROOT_DIR/database/seeds"
|
|
CONTAINER="${POSTGRES_CONTAINER:-meshkee-postgres}"
|
|
DB_USER="${POSTGRES_USER:-meshkee}"
|
|
DB_NAME="${POSTGRES_DB:-meshkee_cms}"
|
|
|
|
"$ROOT_DIR/database/wait-for-postgres.sh"
|
|
|
|
run_seed() {
|
|
local file="$1"
|
|
echo "→ Seeding $(basename "$file")"
|
|
docker exec -i "$CONTAINER" psql -U "$DB_USER" -d "$DB_NAME" < "$file"
|
|
}
|
|
|
|
if [[ $# -gt 0 ]]; then
|
|
run_seed "$1"
|
|
else
|
|
for file in "$SEEDS_DIR"/*.sql; do
|
|
[[ -f "$file" ]] || continue
|
|
run_seed "$file"
|
|
done
|
|
fi
|
|
|
|
echo "Seed complete."
|