Skip to content

Commit f9b1401

Browse files
committed
docs(#192): correct the spec — the flag is --migration-format, not --format
--format is already the GLOBAL output-rendering flag (toon|json|text), consumed in cli/src/index.ts before a command sees it. The original check looked only at migrate.ts and wrongly concluded the name was free. The config key stays migrate.format, which is namespaced under `migrate` and does not clash.
1 parent 6b670c2 commit f9b1401

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

docs/superpowers/specs/2026-08-04-issue-192-flyway-output-adapter-design.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ A **third output adapter**, sibling to the two that already exist:
3838
|---|---|---|
3939
| homegrown (`write-migration.ts`) | `<ts>-<slug>/up.sql` + `down.sql` | default |
4040
| D1/Wrangler (`write-migration-d1.ts`) | `<seq>_<slug>.sql` + `.down/<same>` | `--dialect d1` |
41-
| **Flyway (new)** | `V<N>__<slug>.sql` + `U<N>__<slug>.sql` | `--format flyway` |
41+
| **Flyway (new)** | `V<N>__<slug>.sql` + `U<N>__<slug>.sql` | `--migration-format flyway` |
4242

4343
The diff/emit engine is **untouched**. It already produces `{ up, down }`; an adapter only decides
4444
the envelope. This is exactly ADR-0015 §3's model ("the engine generates the up+down SQL once;
@@ -85,13 +85,19 @@ SQL entirely — it discards something already computed, for no gain.
8585
Flyway renders the description with underscores as spaces, so `V4__add_program_view.sql` is
8686
idiomatic. The D1 adapter sanitizes to hyphens; the Flyway adapter must not copy that.
8787

88-
### D4 — `--format` flag plus a config key
88+
### D4 — `--migration-format` flag plus a config key
8989

90-
`--format flyway|default` on `meta migrate`, also settable once as `migrate.format` in
90+
`--migration-format flyway|default` on `meta migrate`, also settable once as `migrate.format` in
9191
**`.metaobjects/config.json`** — the static project-state file the migrate command already reads via
9292
`tryLoadConfig` → SDK `ConfigSchema.MigrateBlock` (NOT `metaobjects.config.ts`, which carries
9393
generator wiring). Flag overrides config; default is `default`, so existing behavior is untouched.
9494

95+
**Corrected during implementation:** this decision originally specified `--format`. That name is
96+
already taken by the **global** output-rendering flag (`toon` / `json` / `text`), consumed in
97+
`cli/src/index.ts` before any command sees it — the original check looked only at `migrate.ts` and
98+
wrongly concluded it was free. The flag is therefore `--migration-format`. The config key stays
99+
`migrate.format`: nested under `migrate`, it has no such clash.
100+
95101
Rationale: a JVM shop sets it once and forgets, while a one-off generation in another format stays
96102
possible. Flag-only would mean repeating it forever with a forgotten flag silently writing the wrong
97103
layout; config-only would remove the one-off escape.
@@ -115,7 +121,7 @@ existing per-adapter default-fallback pattern: the D1 path already falls back to
115121
in §6.
116122
4. **`sdk/src/config.ts`** — add `format` to the `MigrateBlock` Zod schema, so
117123
`.metaobjects/config.json` can carry `migrate.format`.
118-
5. **`cli/src/lib/args.ts`**`--format` in `parseMigrateArgs` + `MigrateFlags`, validated against
124+
5. **`cli/src/lib/args.ts`**`--migration-format` in `parseMigrateArgs` + `MigrateFlags`, validated against
119125
the closed set (invalid value → parse error, matching the existing `--dialect` handling).
120126

121127
## 5. Data flow
@@ -140,10 +146,10 @@ by #226/#241 (D1 FK cascade) and #258 (PK move):
140146

141147
| Combination | Refusal reason |
142148
|---|---|
143-
| `--format flyway --apply` | Applying behind Flyway desyncs `flyway_schema_history` → use `flyway migrate` |
144-
| `--format flyway apply-pending` | Same — replaying committed migrations is Flyway's job |
145-
| `--format flyway --rollback` | Our ledger does not exist on a Flyway-managed DB → `flyway undo` (Teams) or roll forward |
146-
| `--format flyway --dialect d1` | D1 has its own Wrangler layout and wrangler transport; the combination is meaningless |
149+
| `--migration-format flyway --apply` | Applying behind Flyway desyncs `flyway_schema_history` → use `flyway migrate` |
150+
| `--migration-format flyway apply-pending` | Same — replaying committed migrations is Flyway's job |
151+
| `--migration-format flyway --rollback` | Our ledger does not exist on a Flyway-managed DB → `flyway undo` (Teams) or roll forward |
152+
| `--migration-format flyway --dialect d1` | D1 has its own Wrangler layout and wrangler transport; the combination is meaningless |
147153

148154
Non-fatal behaviors:
149155

@@ -159,7 +165,7 @@ Non-fatal behaviors:
159165
versions (`V10.5__`) → `V11`; `U__` files do **not** bump the counter; slug sanitized to underscores;
160166
trailing newline on both files.
161167

162-
**CLI:** the four refusals in §6, each asserting exit code and message; `--format` precedence
168+
**CLI:** the four refusals in §6, each asserting exit code and message; `--migration-format` precedence
163169
(flag > config > default); dir resolution (`--out-dir` vs the Flyway convention default).
164170

165171
**Real-engine gate (required).** Every migrate change in this repo carries it, because a green unit
@@ -183,7 +189,7 @@ pass unchanged.
183189

184190
- The other ADR-0015 adapters (two-file `.up.sql`/`.down.sql`, single-file-with-divider for
185191
dbmate/goose, Liquibase formatted-SQL). This design deliberately builds only the reference adapter;
186-
the others become mechanical once the `--format` axis exists.
192+
the others become mechanical once the `--migration-format` axis exists.
187193
- Restoring any Java-side migrate goal. Schema stays TS-owned per ADR-0015; JVM consumers run the
188194
Node `meta` CLI for migration generation.
189195
- Closing the engine's modeling gaps (triggers, cross-column CHECKs, function-valued defaults, GIN

0 commit comments

Comments
 (0)