From 9c6ca39e23ef435335104b07ec60bc747a2a9546 Mon Sep 17 00:00:00 2001 From: Jiri Uhlir Date: Wed, 3 Jun 2026 08:40:26 +0200 Subject: [PATCH] Add create enabled flag to app templates --- scripts/migrate-app-templates-v2-db.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 scripts/migrate-app-templates-v2-db.sh diff --git a/scripts/migrate-app-templates-v2-db.sh b/scripts/migrate-app-templates-v2-db.sh new file mode 100755 index 0000000..b4193ae --- /dev/null +++ b/scripts/migrate-app-templates-v2-db.sh @@ -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_templates)").fetchall()] + +if "create_enabled" not in columns: + con.execute("ALTER TABLE app_templates ADD COLUMN create_enabled INTEGER NOT NULL DEFAULT 0") + +con.execute("UPDATE app_templates SET create_enabled = 0") +con.execute("UPDATE app_templates SET create_enabled = 1 WHERE id = 'fastapi'") + +con.commit() +con.close() + +print("App templates v2 migration completed.") +PY