#!/usr/bin/env python3 """Apply ExposedGays chat migration (RLS + DM RPC).""" import paramiko HOST = "10.10.0.11" USER = "localadministrator" PASS = "Bbt9115xty9176!" c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect(HOST, username=USER, password=PASS, timeout=20, allow_agent=False, look_for_keys=False) def run(cmd, t=120): print("$", cmd[:140]) _, o, e = c.exec_command(cmd, timeout=t) code = o.channel.recv_exit_status() out = (o.read() + e.read()).decode(errors="replace") print(out[-3000:]) print("exit", code, "\n") return code with open( r"C:\Users\Local Administrator\exposedgays\supabase\migration_v7_chat.sql", "r", encoding="utf-8", ) as f: sql = f.read() sftp = c.open_sftp() with sftp.file("/tmp/eg_chat_migration.sql", "w") as remote: remote.write(sql) sftp.close() run("cat /tmp/eg_chat_migration.sql | docker exec -i supabase-db psql -U postgres -d postgres 2>&1 | tail -30") c.close() print("Done.")