Files
momentry_core/scripts/update_identity_status.py

26 lines
696 B
Python

#!/opt/homebrew/bin/python3.11
"""
Update identity status from confirmed to pending
"""
import os
import psycopg2
DATABASE_URL = os.getenv("DATABASE_URL", "postgres://accusys@localhost:5432/momentry")
conn = psycopg2.connect(DATABASE_URL)
cur = conn.cursor()
# Update all confirmed identities to pending
cur.execute("UPDATE identities SET status='pending' WHERE status='confirmed'")
rows_affected = cur.rowcount
conn.commit()
print(f"Updated {rows_affected} identities from 'confirmed' to 'pending'")
# Verify
cur.execute("SELECT COUNT(*) FROM identities WHERE status='pending'")
pending_count = cur.fetchone()[0]
print(f"Total pending identities: {pending_count}")
cur.close()
conn.close()