feat(ops): phase 8 — data migration scripts + fix password_reset_tokens in schema.sql

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-24 06:30:34 +08:00
co-authored by Claude Sonnet 4.6
parent 04c36f9d45
commit b3811b3633
6 changed files with 247 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
#!/bin/bash
# Usage: SSH_PASS=<password> bash db/01-load-schema.sh
# Or: configure SSH key auth first, then just: bash db/01-load-schema.sh
set -e
SERVER="setia@ims.setia.com.my"
PORT=9321
echo "==> Copying schema files to server..."
scp -P "$PORT" db/schema.sql db/rls.sql "$SERVER:/tmp/"
echo "==> Loading schema on server..."
ssh -p "$PORT" "$SERVER" "sudo -u postgres psql -d ims -f /tmp/schema.sql && sudo -u postgres psql -d ims -f /tmp/rls.sql"
echo "==> Cleaning up temp files..."
ssh -p "$PORT" "$SERVER" "rm /tmp/schema.sql /tmp/rls.sql"
echo "==> Schema loaded. Verifying table count..."
ssh -p "$PORT" "$SERVER" "sudo -u postgres psql -d ims -c \"SELECT count(*) AS table_count FROM information_schema.tables WHERE table_schema = 'public' AND table_type = 'BASE TABLE';\""
# Expected: 14 tables (13 original + password_reset_tokens)