Skip to content

Flyway migration generation regressed: ADR-0015 removed the meta:migrate --flyway mojo and the shared-engine Flyway output adapter was never built #192

Description

@dmealing

Summary

metaobjects once shipped Flyway-named migration generation for JVM consumers (the Java meta:migrate --flyway Maven mojo, plugin v7.0.0). ADR-0015 consolidated all migration onto the shared TS engine and removed that mojo, designating a "Flyway-prefix output adapter" on the shared engine as its replacement — but that adapter was never built.

Net effect: a Spring-Boot-Kotlin + Exposed + Flyway consumer today has no supported path to generate migrations from metadata. Yet the generated meta init agent-context (.metaobjects/AGENTS.md) still instructs adopters to "never hand-write SQL … apply schema only through meta migrate" — advice that is impossible to follow on a Flyway stack, because there is no meta migrate output that Flyway can consume. This misdirects adopters (human and agent) and forces hand-authored V<n>__*.sql that only a boot-time drift-gate keeps honest.

How it regressed

  • The Java maven-plugin MetaDataMigrateMojo gained a Flyway-naming option in 4ca10dd2 ("feat(maven-plugin): meta:migrate Flyway-naming option for codegen-kotlin consumers"), shipped in Java plugin 7.0.0 (its plugin.xml lists a migrate goal). Design of record: docs/superpowers/specs/2026-05-25-codegen-kotlin-design.md §5.1 — <flyway>true</flyway> → scan flywayDir for the highest V<N>__, increment, emit V<N+1>__<slug>.sql.
  • 77a5c46a ("refactor(omdb)!: remove meta:migrate goal + Java migration-conformance scenarios") removed the mojo and the Java migrate engine behind it, per ADR-0015 (single shared migrate engine). ADR-0015 §3 explicitly designates Flyway-prefix (V__/U__) as reference output adapter fix(cli): scaffold outDir defaults to src/generated, not ./src/db #1 and notes the prior Flyway-emit groundwork "should inform the shared adapter."
  • That adapter was never implemented: server/typescript/packages/migrate-ts/src has zero flyway references. meta migrate emits only its own <seq>-<slug>/up.sql + down.sql layout plus a private ledger table — incompatible with a Flyway flyway_schema_history boot without an adapter.

Impact on JVM/Flyway consumers

  1. No migration-generation path. The current Java maven-plugin (e.g. 7.7.8) exposes goals generate, verify, docs, editor, help — no migrate. The TS CLI's output layout can't feed Flyway. So metadata → Flyway migration must be hand-authored to match codegen — the exact thing the doctrine says never to do.
  2. The generated scaffold actively misdirects. meta init emits .metaobjects/AGENTS.md with "never hand-write SQL … apply schema only through meta migrate." On a Flyway stack there is no such command, so an agent/dev following the scaffold hunts for tooling that does not exist. (This recently cost a real multi-file investigation for one such consumer before the removal history was uncovered.)

Proposed fix

  1. Build the ADR-0015 Flyway-prefix output adapter on the shared TS migrate engine (already the accepted plan-of-record; the removed nextFlywayVersion scanner from 4ca10dd2 is prior art). Emit V<N+1>__<slug>.sql into a configurable flywayDir, diffing the offline snapshot (meta migrate baseline --from-db seeds it once). Prove emitted-DDL fidelity against the codegen-kotlin Exposed table shapes via meta verify --db. Note the known gaps the engine does not yet model (triggers, cross-column CHECKs, function-valued defaults, GIN array indexes) will still require some hand-authored SQL — the adapter should degrade gracefully, not silently drop them.
  2. Until it ships, correct the meta init scaffold so a Flyway-configured consumer's generated .metaobjects/AGENTS.md does not claim meta migrate is the schema-apply path. For a Flyway stack it should state that migrations are hand-authored to match codegen and enforced by the boot-time table/DB drift-gate (meta verify --db) — or at minimum not assert a command that isn't shipped for that stack.

Evidence (all in this repo)

  • ADR: spec/decisions/ADR-0015-single-shared-migrate-engine.md (§3 output-adapter design; Flyway-prefix reference; build path pending)
  • Removed mojo: git show 4ca10dd2 (added Flyway option) / git show 77a5c46a (removed the goal)
  • Superseded design: docs/superpowers/specs/2026-05-25-codegen-kotlin-design.md §5.1
  • The gap: no flyway references anywhere under server/typescript/packages/migrate-ts/src

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions