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:
43
justfile
43
justfile
@@ -33,7 +33,6 @@ deploy:
|
||||
--chown="www-data:posterg" \
|
||||
--exclude 'vendor' \
|
||||
--exclude 'tests' \
|
||||
--exclude 'test.db' \
|
||||
--exclude '*.md' \
|
||||
--exclude '.git*' \
|
||||
--exclude '.jj' \
|
||||
@@ -80,9 +79,9 @@ deploy-nginx:
|
||||
|
||||
[group('deploy')]
|
||||
deploy-db:
|
||||
@ssh posterg '[ ! -f /var/www/posterg/storage/test.db ]' || (echo "ERROR: remote database already exists. Remove it manually if you intend to overwrite." && exit 1)
|
||||
rsync -v --progress app/storage/test.db posterg:/var/www/posterg/storage/test.db
|
||||
ssh posterg "chown www-data:posterg /var/www/posterg/storage/test.db && chmod 660 /var/www/posterg/storage/test.db"
|
||||
@ssh posterg '[ ! -f /var/www/posterg/storage/posterg.db ]' || (echo "ERROR: remote database already exists. Remove it manually if you intend to overwrite." && exit 1)
|
||||
rsync -v --progress app/storage/posterg.db posterg:/var/www/posterg/storage/posterg.db
|
||||
ssh posterg "chown www-data:posterg /var/www/posterg/storage/posterg.db && chmod 660 /var/www/posterg/storage/posterg.db"
|
||||
|
||||
# ============================================================================
|
||||
# Testing
|
||||
@@ -90,20 +89,20 @@ deploy-db:
|
||||
|
||||
[group('test')]
|
||||
test:
|
||||
@DB_ENV=test php app/tests/run-tests.php
|
||||
@php app/tests/run-tests.php
|
||||
|
||||
[group('test')]
|
||||
test-unit:
|
||||
@DB_ENV=test php app/tests/Unit/DatabaseTest.php
|
||||
@DB_ENV=test php app/tests/Unit/RateLimitTest.php
|
||||
@php app/tests/Unit/DatabaseTest.php
|
||||
@php app/tests/Unit/RateLimitTest.php
|
||||
|
||||
[group('test')]
|
||||
test-integration:
|
||||
@DB_ENV=test php app/tests/Integration/SearchTest.php
|
||||
@php app/tests/Integration/SearchTest.php
|
||||
|
||||
[group('test')]
|
||||
test-security:
|
||||
@DB_ENV=test php app/tests/Security/SecurityTest.php
|
||||
@php app/tests/Security/SecurityTest.php
|
||||
|
||||
[group('test')]
|
||||
syntax:
|
||||
@@ -117,41 +116,29 @@ syntax:
|
||||
[group('database')]
|
||||
migrate:
|
||||
@echo "Running migrations…"
|
||||
@bash scripts/migrate.sh both
|
||||
|
||||
[group('database')]
|
||||
migrate-test:
|
||||
@bash scripts/migrate.sh test
|
||||
|
||||
[group('database')]
|
||||
migrate-prod:
|
||||
@bash scripts/migrate.sh prod
|
||||
@bash scripts/migrate.sh
|
||||
|
||||
[group('database')]
|
||||
init-db:
|
||||
@sqlite3 app/storage/test.db < app/storage/schema.sql
|
||||
@sqlite3 app/storage/test.db "SELECT COUNT(*) || ' tables' FROM sqlite_master WHERE type='table';"
|
||||
@sqlite3 app/storage/posterg.db < app/storage/schema.sql
|
||||
@sqlite3 app/storage/posterg.db "SELECT COUNT(*) || ' tables' FROM sqlite_master WHERE type='table';"
|
||||
|
||||
[group('database')]
|
||||
reset-db:
|
||||
@rm -f app/storage/test.db
|
||||
@rm -f app/storage/posterg.db
|
||||
@just init-db
|
||||
|
||||
[group('database')]
|
||||
query:
|
||||
@sqlite3 app/storage/test.db
|
||||
@sqlite3 app/storage/posterg.db
|
||||
|
||||
[group('database')]
|
||||
show id:
|
||||
@sqlite3 -column -header app/storage/test.db "SELECT * FROM v_theses_full WHERE id = {{id}};";
|
||||
@sqlite3 -column -header app/storage/posterg.db "SELECT * FROM v_theses_full WHERE id = {{id}};";
|
||||
|
||||
[group('database')]
|
||||
backup:
|
||||
@sqlite3 app/storage/test.db .dump > app/storage/backup_$(date +%Y%m%d_%H%M%S).sql
|
||||
|
||||
[group('database')]
|
||||
fixtures:
|
||||
@php app/storage/fixtures/CreateTestDatabase.php
|
||||
@sqlite3 app/storage/posterg.db .dump > app/storage/backup_$(date +%Y%m%d_%H%M%S).sql
|
||||
|
||||
# ============================================================================
|
||||
# Utils
|
||||
|
||||
Reference in New Issue
Block a user