62 lines
1.4 KiB
Bash
Executable File
62 lines
1.4 KiB
Bash
Executable File
#!/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_script" not in columns:
|
|
con.execute("ALTER TABLE app_templates ADD COLUMN create_script TEXT")
|
|
|
|
if "deploy_script" not in columns:
|
|
con.execute("ALTER TABLE app_templates ADD COLUMN deploy_script TEXT")
|
|
|
|
con.execute("""
|
|
UPDATE app_templates
|
|
SET create_script = '/tools/new-python-app.sh',
|
|
deploy_script = '/tools/deploy-app.sh',
|
|
create_enabled = 1
|
|
WHERE id = 'fastapi'
|
|
""")
|
|
|
|
con.execute("""
|
|
UPDATE app_templates
|
|
SET create_script = '/tools/new-dotnet-api-app.sh',
|
|
deploy_script = '/tools/deploy-app.sh'
|
|
WHERE id = 'dotnet-api'
|
|
""")
|
|
|
|
con.execute("""
|
|
UPDATE app_templates
|
|
SET create_script = '/tools/new-dotnet-worker-app.sh',
|
|
deploy_script = '/tools/deploy-app.sh'
|
|
WHERE id = 'dotnet-worker'
|
|
""")
|
|
|
|
con.execute("""
|
|
UPDATE app_templates
|
|
SET create_script = '/tools/new-nodejs-ts-app.sh',
|
|
deploy_script = '/tools/deploy-app.sh'
|
|
WHERE id = 'nodejs-ts'
|
|
""")
|
|
|
|
con.execute("""
|
|
UPDATE app_templates
|
|
SET create_script = '/tools/new-static-site-app.sh',
|
|
deploy_script = '/tools/deploy-app.sh'
|
|
WHERE id = 'static-site'
|
|
""")
|
|
|
|
con.commit()
|
|
con.close()
|
|
|
|
print("App template scripts migration completed.")
|
|
PY
|