-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathimport-sql.sh
More file actions
executable file
Β·27 lines (21 loc) Β· 933 Bytes
/
import-sql.sh
File metadata and controls
executable file
Β·27 lines (21 loc) Β· 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
set -e
echo "π Starting PostgreSQL container..."
docker compose up -d db
echo "β³ Waiting for PostgreSQL to be ready..."
until docker exec $(docker compose ps -q db) pg_isready -U postgres > /dev/null 2>&1; do
sleep 1
done
echo "β
PostgreSQL is ready."
echo "π¦ Creating database..."
echo "π Checking if database 'workflow_realm00000' exists..."
if docker exec -i $(docker compose ps -q db) psql -U postgres -tAc "SELECT 1 FROM pg_database WHERE datname = 'workflow_realm00000'" | grep -q 1; then
echo "β
Database 'workflow_realm00000' already exists."
else
echo "β Creating database 'workflow_realm00000'..."
docker exec -i $(docker compose ps -q db) psql -U postgres -c "CREATE DATABASE workflow_realm00000;"
fi
echo "π Importing from data from dump"
docker exec -i $(docker compose ps -q db) psql -U postgres -d workflow_realm00000 < ./workflow.sql
docker compose down
echo "β
Done!"