feat: migrate from MySQL to Postgres with pgschema

Replace MySQL 8.0 with Postgres 17 across the entire stack:

- Add declarative schema/schema.sql for pgschema (merged from 21 migrations)
- Delete migrations/ directory (sqlx migrations no longer used)
- Update all sprout-db queries: positional $N params, ON CONFLICT,
  string_agg, array_position, encode(), pg_catalog partitions
- Update sprout-audit: pg_advisory_lock replaces GET_LOCK
- Update docker-compose, .env.example, justfile, CI, and scripts
- Cargo.toml: sqlx mysql feature → postgres

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Ai-assisted: true
This commit is contained in:
Alec Thomas
2026-03-19 14:32:57 +11:00
parent 97b8a732c4
commit 688846e9bb
65 changed files with 1573 additions and 2195 deletions

View File

@@ -130,7 +130,7 @@ jobs:
docker logs "${container}" || true
return 1
}
wait_healthy "MySQL" "sprout-mysql"
wait_healthy "Postgres" "sprout-postgres"
wait_healthy "Redis" "sprout-redis"
wait_healthy "Typesense" "sprout-typesense"
- name: Build relay
@@ -138,7 +138,7 @@ jobs:
- name: Start relay
run: |
nohup env \
DATABASE_URL=mysql://sprout:sprout_dev@localhost:3306/sprout \
DATABASE_URL=postgres://sprout:sprout_dev@localhost:5432/sprout \
REDIS_URL=redis://localhost:6379 \
TYPESENSE_URL=http://localhost:8108 \
TYPESENSE_API_KEY=sprout_dev_key \