Add RBAC: admin user management, audit log, runtime settings, delete PC
This commit is contained in:
@@ -24,3 +24,17 @@ def get_db():
|
||||
|
||||
def create_tables():
|
||||
Base.metadata.create_all(bind=engine)
|
||||
|
||||
|
||||
def run_migrations():
|
||||
"""Apply lightweight schema migrations for SQLite."""
|
||||
from sqlalchemy import inspect, text
|
||||
insp = inspect(engine)
|
||||
|
||||
# AuditLog: add username column if missing
|
||||
if "audit_log" in insp.get_table_names():
|
||||
audit_cols = {c["name"] for c in insp.get_columns("audit_log")}
|
||||
if "username" not in audit_cols:
|
||||
with engine.connect() as conn:
|
||||
conn.execute(text("ALTER TABLE audit_log ADD COLUMN username TEXT"))
|
||||
conn.commit()
|
||||
|
||||
Reference in New Issue
Block a user