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:
Théophile Gervreau-Mercier
2026-04-27 18:07:03 +02:00
parent 780105eec0
commit 7e26351f4b
12 changed files with 195 additions and 496 deletions

View File

@@ -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"

View File

@@ -34,12 +34,12 @@ else
echo "✓ Cloned php-live-reload"
fi
# Create test database if needed
if [ ! -f "storage/test.db" ]; then
# Create posterg.db if needed
if [ ! -f "storage/posterg.db" ]; then
echo ""
echo "📊 Creating test database..."
sqlite3 storage/test.db < storage/schema.sql
echo "✓ Created test database"
echo "📊 Creating posterg.db…"
sqlite3 storage/posterg.db < storage/schema.sql
echo "✓ Created posterg.db"
fi
# Create data directories