-- Bootstrap for the single, schema-separated platform database.
--
-- Runs once, on an empty data volume (postgres image initdb hook). Every app owns
-- exactly one schema and applies its own migrations into it; nothing here creates
-- tables. Ownership map:
--
--   iam          edr-freight-api  (`pnpm iam:migration:run`, ships with @tria-plc/iamapi-common)
--                                 -> history in iam.typeorm_migrations
--   freight      edr-freight-api  -> history in freight.migrations
--   passenger    edr-passenger-api (Prisma) -> history in passenger._prisma_migrations
--   edr_payment  edr-payment-api  -> its own TypeORM history
--   audit        @tria-plc/auditlog consumer
--
-- Cross-schema references stay SOFT (plain UUID columns + denormalized display
-- fields). Co-location makes hard FKs possible; the platform deliberately does not
-- use them, so IAM stays independently deployable and the audit trail outlives a
-- deleted user.
CREATE SCHEMA IF NOT EXISTS iam;
CREATE SCHEMA IF NOT EXISTS freight;
CREATE SCHEMA IF NOT EXISTS passenger;
CREATE SCHEMA IF NOT EXISTS edr_payment;
CREATE SCHEMA IF NOT EXISTS audit;
