Skip to content

feat(appkit): offer the database plugin in databricks apps init - #675

Draft
ditadi wants to merge 1 commit into
stack/database-dev-flow/06-db-verifyfrom
stack/database-dev-flow/07-apps-init
Draft

ditadi wants to merge 1 commit into
stack/database-dev-flow/06-db-verifyfrom
stack/database-dev-flow/07-apps-init

Conversation

@ditadi

@ditadi ditadi commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Stacked on #674.

Summary

Offers the DatabasePlugin in databricks apps init, and documents the development flow end to end. The flow:

  • appkit db init points .env at a Lakebase branch of your own.
  • appkit db migrate writes and applies migrations as you change config/database/schema.ts.
  • The deployed app applies the committed migrations on start.
  • appkit db verify checks your branch, and with --prod the deployed app.
  • One owner per branch: the app's service principal owns the schema on the deploy branch.

Details

  • The plugin manifest is no longer hidden. The plugin barrel exports database, so beta.ts drops its explicit export. The appkit db commands are no longer hidden in the CLI.
  • Template changes:
    • config/database/schema.ts uses schema app.
    • appkit.plugins.json gets the database entry, with the postgres binding for branch and database.
    • README.md.tmpl gets a development-workflow section and config/database/ in the project structure.
    • _gitignore skips config/database/*.bak, the previous schema.ts that introspect keeps.
  • drizzle-kit is a template devDependency, since appkit db init/migrate generate migrations with it. check-template-deps keeps it at the version AppKit pins, and its skew message gives each synced dependency its reason.
    • Every scaffolded app gets it, with or without the plugin. apps init installs from the template's single committed lockfile (npm ci / pnpm --frozen-lockfile), so the dependency can't be dropped per app.
    • It is dev-only. Installs show two deprecation notices from drizzle-kit's own @esbuild-kit dependencies.
  • The template locks gain drizzle-kit and its 59 dependencies, all from registry.npmjs.org. No existing package changes version.
  • databricks apps init running appkit db init for you is a separate Databricks CLI change. This PR should land once a CLI release with that change is out.

Tests

  • I checked the plugin docs and README claims against the code of feat(appkit): apply committed database migrations on deploy start #654–feat(appkit): add appkit db verify #674: init flags and branch choice, migrate/clean/seed refusals, the introspect migration name, and verify/--prod.
  • I rendered README.md.tmpl with Go text/template and missingkey=zero, the way apps init does, for four plugin sets: none, analytics, database, and both.
  • tools/check-template-deps.ts passes. With the template's drizzle-kit version changed, it reports the new skew message.
  • Full gate passes: build, typecheck, lint/format, knip, generate:types and sync:template (no diff), the docs build, and 6075 tests.

The DatabasePlugin is no longer hidden from `databricks apps init`. The
template ships config/database/schema.ts in the app schema and a README
section on the development workflow, and the plugin docs describe the
flow end to end: `appkit db init` for a branch of your own, `appkit db
migrate` while you develop, migrations applied by the deployed app on start,
`appkit db verify` to check both sides, and one owner per branch.

The template lists drizzle-kit as a dev dependency, since `appkit db init`
and `appkit db migrate` generate migrations with it; check-template-deps
keeps it at the version AppKit pins. Every scaffolded app gets it, with or
without the plugin: `apps init` installs from the template's one committed
lockfile with npm ci / pnpm --frozen-lockfile, so the dependency cannot be
dropped per app. It is dev-only and adds two deprecation notices on install
(drizzle-kit's own @esbuild-kit dependencies).

The template's .gitignore skips config/database/*.bak, the copy of schema.ts
that `appkit db introspect` keeps.

Signed-off-by: ditadi <victordperd@gmail.com>

This branch has not been deployed

No deployments
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.

1 participant