Concept
Phase 2A refuses to let Hibernate invent the model. The database gets the invariants first, then entities map onto what the database already knows.
Task
- Read the frozen domain model.
- Explain why occupied_until is stored on showtime.
- Sketch the Postgres exclusion constraint in schema-notes.md.
Run
docker compose up -d postgres./gradlew flywayMigrateExpected Result
- Your notes explain row-local occupancy windows and source-system-aware external IDs.
Common Traps
- Trying to join movie.duration_minutes inside a Postgres exclusion constraint.
- Using a floating-point price.
- Making source_external_id globally unique without source_system.
Hint Ladder
Hint 1
A showtime is a booking fact. Later movie duration corrections must not rewrite history.
Hint 2
The exclusion constraint can only see columns on the showtime row.
Hint 3
The schema should say what the app means, even when demo data is small.
Solution
Preview only. Full solution lands with World 2A.