feat(containers): add agnostic db-migrator container for automated SQL migrations #10

Open
opened 2026-11-11 06:50:05 +00:00 by crapougnax · 0 comments
Owner

Context & Problem Statement

Currently, SQL database migrations across Quatrain ecosystem services (such as Brad, TotalYmage, etc.) need an industrial, containerized, and database-agnostic migration runner capable of executing versioned SQL files on (re-)start.

Proposed Solution

Introduce containers/db-migrator in CoreApps:

  • Pluggable adapter architecture (DatabaseMigrationAdapterInterface) with immediate support for PostgreSQL / Supabase / Neon / RDS.
  • Extensible design ready for additional database dialects (MySQL, SQLite) in the future.
  • Robust execution: idempotent execution, transaction wrapping, statement-by-statement recovery for pre-existing objects, and automatic PostgREST schema reloading.
  • Standard OCI-compliant ContainerFile using oven/bun:alpine.
  • Integration into sovereign Forgejo CI workflow.

Acceptance Criteria

  • Full TypeScript implementation with zero as any bypasses.
  • Unit tests validating SQL statement parser, adapter contracts, and migration runner.
  • ContainerFile passes docker build.
  • Documentation (README.md, HOWTO.md, .env.dist).

Migrated from GitHub mirror: https://github.com/Quatrain/CoreApps/issues/16

## Context & Problem Statement Currently, SQL database migrations across Quatrain ecosystem services (such as Brad, TotalYmage, etc.) need an industrial, containerized, and database-agnostic migration runner capable of executing versioned SQL files on (re-)start. ## Proposed Solution Introduce `containers/db-migrator` in `CoreApps`: - Pluggable adapter architecture (`DatabaseMigrationAdapterInterface`) with immediate support for PostgreSQL / Supabase / Neon / RDS. - Extensible design ready for additional database dialects (MySQL, SQLite) in the future. - Robust execution: idempotent execution, transaction wrapping, statement-by-statement recovery for pre-existing objects, and automatic PostgREST schema reloading. - Standard OCI-compliant `ContainerFile` using `oven/bun:alpine`. - Integration into sovereign Forgejo CI workflow. ## Acceptance Criteria - Full TypeScript implementation with zero `as any` bypasses. - Unit tests validating SQL statement parser, adapter contracts, and migration runner. - `ContainerFile` passes docker build. - Documentation (`README.md`, `HOWTO.md`, `.env.dist`). --- _Migrated from GitHub mirror: https://github.com/Quatrain/CoreApps/issues/16_
Sign in to join this conversation.
No labels
enhancement
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
quatrain/core-apps#10
No description provided.