chore: stage changes before history rewrite

This commit is contained in:
2026-07-07 11:28:18 +08:00
parent a619b919be
commit 137304090a
13 changed files with 670 additions and 83 deletions

View File

@@ -0,0 +1,20 @@
"""Migrate: add permissions column to api_keys 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("PRAGMA table_info(api_keys)")
cols = [r[1] for r in cur.fetchall()]
if "permissions" not in cols:
cur.execute('ALTER TABLE api_keys ADD COLUMN permissions TEXT NOT NULL DEFAULT "[]"')
conn.commit()
print("OK: column 'permissions' added to api_keys")
else:
print("SKIP: column 'permissions' already exists")
conn.close()