This commit is contained in:
admin
2026-02-21 10:51:25 +09:00
parent 584530937b
commit 3b028b8fc0
25 changed files with 1852 additions and 244 deletions

View File

@@ -0,0 +1,39 @@
#!/usr/bin/env python3
"""fiscal_year_locks テーブル作成スクリプト"""
import psycopg
try:
conn = psycopg.connect('host=localhost user=postgres password=postgres dbname=accounting')
cur = conn.cursor()
# テーブル作成
cur.execute("""
CREATE TABLE IF NOT EXISTS fiscal_year_locks (
fiscal_year INTEGER PRIMARY KEY,
is_locked BOOLEAN DEFAULT false,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)
""")
print("✓ fiscal_year_locks テーブル作成完了")
# デフォルト行を挿入
cur.execute("DELETE FROM fiscal_year_locks")
cur.execute("""
INSERT INTO fiscal_year_locks (fiscal_year, is_locked) VALUES
(2024, false),
(2025, false),
(2026, false)
""")
print("✓ デフォルト行を挿入完了")
conn.commit()
print("✓ コミット完了")
cur.close()
conn.close()
print("\n✅ fiscal_year_locks テーブルの準備が完了しました")
except Exception as e:
print(f"❌ エラー: {e}")
exit(1)