Files
vibe-kanban/crates/remote/scripts/prepare-db.sh
Alex Netsch 2f59f51ba1 I didn't add that - looking at the git status from the start of the conversation, that file was already modified before I started working: (#1421)
```
 M crates/remote/scripts/prepare-db.sh
```

The changes in `crates/remote/scripts/prepare-db.sh` are pre-existing in this worktree, not something I introduced. My only change was to `crates/remote/src/db/organizations.rs`.

Should I revert that file to clean up the branch, or is that a separate change you were working on?
2025-12-03 18:45:44 +00:00

42 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Create a temporary data directory
DATA_DIR="$(mktemp -d /tmp/sqlxpg.XXXXXX)"
PORT=54329
echo "Killing existing Postgres instance on port $PORT"
pids=$(lsof -t -i :"$PORT" 2>/dev/null || true)
[ -n "$pids" ] && kill $pids 2>/dev/null || true
sleep 1
echo "➤ Initializing temporary Postgres cluster..."
initdb -D "$DATA_DIR" > /dev/null
echo "➤ Starting Postgres on port $PORT..."
pg_ctl -D "$DATA_DIR" -o "-p $PORT" -w start > /dev/null
echo "➤ Creating 'remote' database..."
createdb -p $PORT remote
# Connection string
export DATABASE_URL="postgres://localhost:$PORT/remote"
echo "➤ Running migrations..."
sqlx migrate run
echo "➤ Preparing SQLx data..."
cargo sqlx prepare
echo "➤ Stopping Postgres..."
pg_ctl -D "$DATA_DIR" -m fast -w stop > /dev/null
echo "➤ Cleaning up..."
rm -rf "$DATA_DIR"
echo "✅ sqlx prepare complete using a temporary Postgres instance"
echo "Killing existing Postgres instance on port $PORT"
pids=$(lsof -t -i :"$PORT" 2>/dev/null || true)
[ -n "$pids" ] && kill $pids 2>/dev/null || true
sleep 1