Add comprehensive thesis management system with database migration

This commit introduces a complete thesis management interface and migrates
the system from YAML-based storage to SQLite:

Core Changes:
- Add Database.php helper class with PDO connection and entity management
- Add list.php for viewing all theses with filtering and sorting
- Add edit.php for modifying existing thesis records
- Add import.php for migrating legacy YAML data to SQLite
- Add justfile with development tasks (serve, init-test-db, etc.)

Documentation:
- Add MIGRATION.md with complete migration guide and architecture docs
- Update README.md with database setup and Just recipe instructions
- Update .gitignore to exclude test databases and error logs

Modified Forms:
- Enhanced formulaire.php with transaction-based SQLite processing
- Updated index.php with database-driven form options
- Improved thanks.php to read from database views

The new architecture provides:
- Normalized database schema (19 tables, 2 views)
- Transaction safety and referential integrity
- CRUD operations for thesis management
- Filtering by year, orientation, AP program, publication status
- Secure file handling with metadata tracking

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Théophile Gervreau-Mercier
2026-01-27 15:43:01 +01:00
parent 99ccd60f90
commit 95f52d549e
22 changed files with 3263 additions and 725 deletions

78
formulaire/justfile Normal file
View File

@@ -0,0 +1,78 @@
# Justfile for Post-ERG thesis form testing
# Default recipe - show available commands
default:
@just --list
# Create test database from schema
init-test-db:
@echo "Creating test database from schema..."
@sqlite3 test.db < ../db/schema.sql
@echo "✓ Test database created: test.db"
@sqlite3 test.db "SELECT COUNT(*) || ' tables created' FROM sqlite_master WHERE type='table';"
@sqlite3 test.db "SELECT COUNT(*) || ' orientations loaded' FROM orientations;"
@sqlite3 test.db "SELECT COUNT(*) || ' AP programs loaded' FROM ap_programs;"
# Start PHP development server
serve: init-test-db
@echo "Starting PHP development server on http://localhost:3000"
@echo "Press Ctrl+C to stop"
@php -S 127.0.0.1:3000
# Start server without reinitializing database
serve-only:
@echo "Starting PHP development server on http://localhost:3000"
@echo "Press Ctrl+C to stop"
@php -S 127.0.0.1:3000
# Clean up test database and uploaded files
cleanup:
@echo "Cleaning up test files..."
@rm -f test.db
@rm -f error.log
@rm -rf data/theses/*
@rm -rf data/covers/*
@echo "✓ Cleanup complete"
# Reset: cleanup and reinitialize
reset: cleanup init-test-db
@echo "✓ Test environment reset"
# Show database statistics
stats:
@echo "=== Database Statistics ==="
@sqlite3 test.db "SELECT COUNT(*) || ' theses' FROM theses;"
@sqlite3 test.db "SELECT COUNT(*) || ' authors' FROM authors;"
@sqlite3 test.db "SELECT COUNT(*) || ' supervisors' FROM supervisors;"
@sqlite3 test.db "SELECT COUNT(*) || ' keywords' FROM keywords;"
@sqlite3 test.db "SELECT COUNT(*) || ' files uploaded' FROM thesis_files;"
# Show recent submissions
recent:
@echo "=== Recent Submissions ==="
@sqlite3 -column -header test.db "SELECT identifier, title, year, submitted_at FROM theses ORDER BY submitted_at DESC LIMIT 5;"
# Query database interactively
query:
@sqlite3 test.db
# Show full thesis details
show id:
@sqlite3 -column -header test.db "SELECT * FROM v_theses_full WHERE id = {{id}};"
# Dump database to SQL
dump:
@sqlite3 test.db .dump > test_backup_$(date +%Y%m%d_%H%M%S).sql
@echo "✓ Database dumped to test_backup_$(date +%Y%m%d_%H%M%S).sql"
# Create data directories if they don't exist
setup-dirs:
@mkdir -p data/theses
@mkdir -p data/covers
@mkdir -p data/yaml
@touch data/theses/.gitkeep
@touch data/covers/.gitkeep
@echo "✓ Data directories created"
# Full setup: directories + database + serve
dev: setup-dirs init-test-db serve