mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 11:09:18 +02:00
feat: extract MediaController, wire into Dispatcher, delete media.php
This commit is contained in:
@@ -8,9 +8,10 @@
|
||||
set -euo pipefail
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
MIGRATIONS_DIR="$REPO_ROOT/storage/migrations"
|
||||
TEST_DB="$REPO_ROOT/storage/test.db"
|
||||
PROD_DB="$REPO_ROOT/storage/posterg.db"
|
||||
APP_DIR="$REPO_ROOT/app"
|
||||
MIGRATIONS_DIR="$APP_DIR/storage/migrations"
|
||||
TEST_DB="$APP_DIR/storage/test.db"
|
||||
PROD_DB="$APP_DIR/storage/posterg.db"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Check whether a migration's effects are already present in the DB so that
|
||||
@@ -58,6 +59,15 @@ already_applied_structurally() {
|
||||
col=$(sqlite3 "$db" "SELECT COUNT(*) FROM pragma_table_info('authors') WHERE name='show_contact';")
|
||||
[ "$tbl" -eq 1 ] && [ "$col" -eq 1 ]
|
||||
;;
|
||||
012_smtp_settings.sql)
|
||||
tbl=$(sqlite3 "$db" "SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='smtp_settings';")
|
||||
[ "$tbl" -eq 1 ]
|
||||
;;
|
||||
013_admin_password.sql)
|
||||
# Effect: admin_password_hash key exists in site_settings (INSERT OR IGNORE — safe to re-run)
|
||||
count=$(sqlite3 "$db" "SELECT COUNT(*) FROM site_settings WHERE key='admin_password_hash';")
|
||||
[ "$count" -eq 1 ]
|
||||
;;
|
||||
*)
|
||||
# Unknown migration — assume not applied
|
||||
return 1
|
||||
@@ -74,7 +84,7 @@ migrate_db() {
|
||||
table_count=$(sqlite3 "$db" "SELECT COUNT(*) FROM sqlite_master WHERE type='table';" 2>/dev/null || echo 0)
|
||||
if [ "$table_count" -eq 0 ]; then
|
||||
echo " [$label] initialising from schema…"
|
||||
sqlite3 "$db" < "$REPO_ROOT/storage/schema.sql"
|
||||
sqlite3 "$db" < "$APP_DIR/storage/schema.sql"
|
||||
echo " [$label] schema applied."
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user