Module: SQL
SQL·165·4 MIN READ

165: SQL - Persistence Checkpoint

TOPICS COVERED: SQL - Persistence Checkpoint

Assessment

Replace one task-manager repository with PostgreSQL while preserving the existing API contract, ownership checks, validation behavior, and error envelope.

Required evidence

  • repeatable migrations create the schema;
  • constraints reject invalid state;
  • tests use an isolated disposable database;
  • important queries have an index rationale and query-plan note;
  • a transaction test proves rollback;
  • the API does not expose database errors.

Exit rule

Proceed only when the same request matrix passes against SQL and the original persistence layer's behavior is documented. The database choice is a tradeoff, not a rewrite of the public contract.

Review questions

  1. Which invariants are enforced in SQL and which remain service rules?
  2. What happens if a request succeeds but the response is lost?
  3. Which query receives the composite index, and what query does it not help?
  4. How are migrations applied safely while an older application is still running?