423baff73b
- Docker bridge 网络隔离(8000 端口封死) - Gunicorn 4 Worker 多进程 - Alembic 数据库迁移基线 - 日志轮转 20m×3 - JWT 密钥 + DB 密码 + CORS 收紧 - 3-2-1 备份链路(NAS + R740-B 冷备) - 连接池 pool_pre_ping + pool_recycle=3600
36 lines
968 B
Python
36 lines
968 B
Python
import psycopg2
|
|
|
|
conn = psycopg2.connect(
|
|
host="192.168.1.85",
|
|
port=5432,
|
|
user="admin",
|
|
password="admin_password_2026",
|
|
dbname="lubrication_crm",
|
|
)
|
|
cur = conn.cursor()
|
|
|
|
# Check table structures
|
|
for t in ["users", "clients", "follow_ups", "expenses"]:
|
|
cur.execute(f"""
|
|
SELECT column_name, data_type, is_nullable, column_default
|
|
FROM information_schema.columns
|
|
WHERE table_name = '{t}'
|
|
ORDER BY ordinal_position
|
|
""")
|
|
print(f"\n=== {t} ===")
|
|
for row in cur.fetchall():
|
|
print(f" {row[0]:20s} | {row[1]:20s} | null={row[2]} | default={row[3]}")
|
|
|
|
# Check constraints
|
|
cur.execute(f"""
|
|
SELECT conname, contype
|
|
FROM pg_constraint
|
|
JOIN pg_class ON conrelid = pg_class.oid
|
|
WHERE pg_class.relname = '{t}'
|
|
""")
|
|
constraints = cur.fetchall()
|
|
if constraints:
|
|
print(f" Constraints: {constraints}")
|
|
|
|
conn.close()
|