Files
Neo-ZQYY/scripts/ops/_fix_dev_user_status.py

19 lines
548 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""修正 dev_test_openid 用户状态为 pending与已有申请记录一致"""
import os
import psycopg2
from dotenv import load_dotenv
load_dotenv()
dsn = os.environ["APP_DB_DSN"]
conn = psycopg2.connect(dsn)
conn.autocommit = True
cur = conn.cursor()
cur.execute("UPDATE auth.users SET status = 'pending', updated_at = NOW() WHERE wx_openid = 'dev_test_openid'")
print(f"更新行数: {cur.rowcount}")
cur.execute("SELECT id, status FROM auth.users WHERE wx_openid = 'dev_test_openid'")
print(f"验证: {cur.fetchone()}")
conn.close()