Update settings/admin UI and misc fixes
This commit is contained in:
@@ -3,7 +3,7 @@ from flask import Flask, jsonify, request
|
||||
from werkzeug.exceptions import RequestEntityTooLarge
|
||||
|
||||
from .extensions import db, login_manager
|
||||
from .models import User
|
||||
from .models import AppSettings, User
|
||||
from .cli import init_db_command
|
||||
|
||||
|
||||
@@ -64,6 +64,19 @@ def create_app():
|
||||
if "storage_max_bytes" not in company_cols:
|
||||
db.session.execute(db.text("ALTER TABLE company ADD COLUMN storage_max_bytes BIGINT"))
|
||||
db.session.commit()
|
||||
|
||||
# AppSettings: create settings table if missing.
|
||||
# (PRAGMA returns empty if the table doesn't exist.)
|
||||
settings_cols = [
|
||||
r[1] for r in db.session.execute(db.text("PRAGMA table_info(app_settings)")).fetchall()
|
||||
]
|
||||
if not settings_cols:
|
||||
AppSettings.__table__.create(db.engine, checkfirst=True)
|
||||
|
||||
# AppSettings: add public_domain column if missing.
|
||||
if settings_cols and "public_domain" not in settings_cols:
|
||||
db.session.execute(db.text("ALTER TABLE app_settings ADD COLUMN public_domain VARCHAR(255)"))
|
||||
db.session.commit()
|
||||
except Exception:
|
||||
db.session.rollback()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user