Skip to content

Adopt golang-migrate for standardized schema migrations #115

Description

@haasonsaas

Context

Each Go service invents its own migration approach:

  • objectives: bespoke EnsureSchema() — runs all SQL via CREATE TABLE IF NOT EXISTS at startup. No history table, no rollback, no versioning.
  • asb: custom migrate.Runner reading .sql files from disk
  • entities/connectors/skills: re-run CREATE TABLE IF NOT EXISTS on every startup
  • Python services use Alembic via fermata/migrations

No service uses goose, golang-migrate, or Atlas. Migrations run inline at startup, making zero-downtime schema changes risky (DDL locks during traffic).

Requirements

  • Add golang-migrate (or goose) as a shared dependency in service-runtime
  • Add migrate.Run(db, migrationsDir) helper that services call at startup
  • Support up, down, version commands via CLI flag or env var
  • Add a pre-deploy migration Job template for Helm charts (like the Python migration-job.yaml ArgoCD PreSync hook)
  • Migrate at least one service (e.g., objectives or audit) as a reference implementation
  • Document migration best practices: online DDL, CREATE INDEX CONCURRENTLY, advisory locks

Impact

Enables safe schema evolution across 15+ Go services. Currently any ALTER TABLE that needs a migration path beyond IF NOT EXISTS is impossible without custom code per service.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions