This commit is contained in:
admin
2026-02-20 15:47:27 +09:00
parent c60cbf2d9a
commit 584530937b
108 changed files with 12112 additions and 416 deletions

53
check_db_schema.py Normal file
View File

@@ -0,0 +1,53 @@
#!/usr/bin/env python3
import psycopg
try:
conn = psycopg.connect(
host='192.168.0.61',
port=55432,
dbname='njts_acct',
user='njts_app',
password='njts_app2025'
)
with conn.cursor() as cur:
# 查看 journal_entries 表的所有列
cur.execute("""
SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = 'journal_entries'
ORDER BY ordinal_position
""")
cols = cur.fetchall()
print("journal_entries 表的所有列:")
print("-" * 50)
for col in cols:
print(f'{col[0]:25} {col[1]}')
print("\n版本追踪字段检查:")
print("-" * 50)
cur.execute("""
SELECT COUNT(*) as cnt
FROM information_schema.columns
WHERE table_name = 'journal_entries'
AND column_name IN ('is_latest', 'revision_count', 'original_entry_id')
""")
count = cur.fetchone()[0]
print(f"版本追踪字段存在: {count}/3")
# 检查 test元 的数据
print("\n【test元】仕訳数据检查")
print("-" * 50)
cur.execute("""
SELECT journal_entry_id, entry_date, description,
is_latest, revision_count, original_entry_id
FROM journal_entries
WHERE description LIKE '%test%'
ORDER BY journal_entry_id
""")
rows = cur.fetchall()
for row in rows:
print(row)
conn.close()
except Exception as e:
print(f'错误: {e}')