chore: stage changes before history rewrite
This commit is contained in:
24
scripts/migrate_system_config.py
Normal file
24
scripts/migrate_system_config.py
Normal file
@@ -0,0 +1,24 @@
|
||||
"""Migrate: create system_config table."""
|
||||
import sqlite3
|
||||
from pathlib import Path
|
||||
|
||||
DB_PATH = Path(__file__).parent.parent / "postcard.db"
|
||||
|
||||
conn = sqlite3.connect(str(DB_PATH))
|
||||
cur = conn.cursor()
|
||||
|
||||
cur.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='system_config'")
|
||||
if not cur.fetchone():
|
||||
cur.execute(
|
||||
"CREATE TABLE system_config ("
|
||||
"key TEXT PRIMARY KEY, "
|
||||
"value TEXT NOT NULL DEFAULT '', "
|
||||
"updated_at TIMESTAMP"
|
||||
")"
|
||||
)
|
||||
conn.commit()
|
||||
print("OK: system_config table created")
|
||||
else:
|
||||
print("SKIP: system_config table exists")
|
||||
|
||||
conn.close()
|
||||
Reference in New Issue
Block a user