Add app variable metadata
This commit is contained in:
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
DB_FILE="/opt/appfactory/data/appfactory/appfactory.db"
|
||||
|
||||
python3 - "$DB_FILE" <<'PY'
|
||||
import sqlite3
|
||||
import sys
|
||||
|
||||
db_file = sys.argv[1]
|
||||
con = sqlite3.connect(db_file)
|
||||
|
||||
columns = [row[1] for row in con.execute("PRAGMA table_info(app_variables)").fetchall()]
|
||||
|
||||
if "description" not in columns:
|
||||
con.execute("ALTER TABLE app_variables ADD COLUMN description TEXT")
|
||||
|
||||
if "required" not in columns:
|
||||
con.execute("ALTER TABLE app_variables ADD COLUMN required INTEGER NOT NULL DEFAULT 0")
|
||||
|
||||
con.commit()
|
||||
con.close()
|
||||
|
||||
print("App variables v2 migration completed.")
|
||||
PY
|
||||
Reference in New Issue
Block a user