mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 11:09:18 +02:00
refactor: remove test.db, use only posterg.db for all environments
- Simplified Database.php determineDatabasePath to always use posterg.db - Removed test.db auto-detection based on php_sapi_name - Removed test.db targets from justfile (migrate-test removed) - Removed CreateTestDatabase.php fixture script - Updated migrate.sh to only init posterg.db - Updated setup-dev.sh to init posterg.db - Updated run-tests.php (removed DB_ENV=test env var) - Updated deploy-db to use posterg.db - Removed test.db file refactor: remove empty fixtures directory
This commit is contained in:
@@ -1,17 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# Initialise one or both SQLite databases from schema.sql.
|
||||
# Initialise the Post-ERG SQLite database from schema.sql.
|
||||
# Safe to run on existing databases — schema uses IF NOT EXISTS / INSERT OR IGNORE.
|
||||
# Usage:
|
||||
# scripts/migrate.sh # both test.db and posterg.db
|
||||
# scripts/migrate.sh test # storage/test.db only
|
||||
# scripts/migrate.sh prod # storage/posterg.db only
|
||||
# scripts/migrate.sh # posterg.db (default)
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
APP_DIR="$REPO_ROOT/app"
|
||||
SCHEMA="$APP_DIR/storage/schema.sql"
|
||||
TEST_DB="$APP_DIR/storage/test.db"
|
||||
PROD_DB="$APP_DIR/storage/posterg.db"
|
||||
|
||||
init_db() {
|
||||
@@ -22,17 +19,4 @@ init_db() {
|
||||
echo " [$label] done"
|
||||
}
|
||||
|
||||
TARGET="${1:-both}"
|
||||
|
||||
case "$TARGET" in
|
||||
test) init_db "$TEST_DB" "test.db" ;;
|
||||
prod) init_db "$PROD_DB" "posterg.db" ;;
|
||||
both)
|
||||
init_db "$TEST_DB" "test.db"
|
||||
init_db "$PROD_DB" "posterg.db"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 [test|prod|both]" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
init_db "$PROD_DB" "posterg.db"
|
||||
|
||||
Reference in New Issue
Block a user