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:
Executable
+20
@@ -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)
|
||||
Reference in New Issue
Block a user