Skip to content

fix(drizzle): fall back to drizzle-kit CLI#632

Open
utopyin wants to merge 1 commit into
alchemy-run:mainfrom
utopyin:utopy/drizzle-cli-fallback-generate
Open

fix(drizzle): fall back to drizzle-kit CLI#632
utopyin wants to merge 1 commit into
alchemy-run:mainfrom
utopyin:utopy/drizzle-cli-fallback-generate

Conversation

@utopyin

@utopyin utopyin commented Jun 17, 2026

Copy link
Copy Markdown

Handle Drizzle dialect modules that no longer expose the programmatic migration API by falling back to drizzle-kit generate.

if (!kit.generateDrizzleJson || !kit.generateMigration) {
  return yield* detectDriftWithCli(props);
}

For diff, the fallback copies the current migrations into a temp directory and runs drizzle-kit there so planning can detect whether the CLI would create a new migration without mutating the real out directory.

For reconcile, drizzle-kit owns the write path directly:

if (drift.mode === "cli" && drift.changed) {
  yield* runDrizzleGenerate(props, drift.out);
}

The CLI invocation uses the repo's Effect child-process wrapper and resolves the package-local drizzle-kit/bin.cjs entrypoint. Local TTY runs inherit stdio so Drizzle rename prompts can be answered; CI/non-TTY runs keep piped stdio so interactive prompts fail fast.

Adds sqlite coverage for initial generation, no-drift repeated deploys, drift updates through the CLI fallback and any interactive prompt in CI/non-TTY exit with a failure.

@utopyin utopyin marked this pull request as ready for review June 17, 2026 06:49
@utopyin utopyin force-pushed the utopy/drizzle-cli-fallback-generate branch 2 times, most recently from 60adc20 to 9dac5e7 Compare June 17, 2026 07:11
@utopyin utopyin force-pushed the utopy/drizzle-cli-fallback-generate branch from 9dac5e7 to 17d6c90 Compare June 17, 2026 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants