# PostgreSQL Migration Guidance (State 005)

> For the complete documentation index, see [llms.txt](https://deploy-preview-472--lucky-concha-f3599f.netlify.app/llms.txt).

Parent state: `004-containerized-compose-runtime`

## Intent

Migrate only the runtime database engine from H2 to PostgreSQL while preserving baseline functional behavior and service contracts.

## Migration Steps

1.  Generate parent state `004` artifacts.
2.  Replace compose database service with PostgreSQL container + init SQL mount.
3.  Update datasource properties and drivers for DB-dependent services:
    *   `account-service`
    *   `position-service`
    *   `trade-processor`
4.  Preserve business flow behavior and endpoint contracts.
5.  Validate with state-specific smoke checks.

## Compatibility Notes

*   Baseline API and event contracts remain unchanged.
*   H2 web console is intentionally removed from runtime expectations.
*   Account ID sequencing is preserved using PostgreSQL sequence `accounts_seq`.
