mirror of
https://git.meshkee.com/Meshkee/backend.git
synced 2026-08-12 06:40:58 +04:30
Initial commit: Meshkee CMS API
NestJS backend with Prisma, Docker Compose for Postgres/Redis, and deploy docs for the production VM.
This commit is contained in:
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
MIGRATIONS_DIR="$ROOT_DIR/database/migrations"
|
||||
CONTAINER="${POSTGRES_CONTAINER:-meshkee-postgres}"
|
||||
DB_USER="${POSTGRES_USER:-meshkee}"
|
||||
DB_NAME="${POSTGRES_DB:-meshkee_cms}"
|
||||
|
||||
"$ROOT_DIR/database/wait-for-postgres.sh"
|
||||
|
||||
run_migration() {
|
||||
local file="$1"
|
||||
echo "→ Running $(basename "$file")"
|
||||
docker exec -i "$CONTAINER" psql -U "$DB_USER" -d "$DB_NAME" < "$file"
|
||||
}
|
||||
|
||||
if [[ $# -gt 0 ]]; then
|
||||
run_migration "$1"
|
||||
else
|
||||
for file in "$MIGRATIONS_DIR"/*.sql; do
|
||||
[[ -f "$file" ]] || continue
|
||||
run_migration "$file"
|
||||
done
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
Reference in New Issue
Block a user