Repository navigation
Conversation
Contributor
📦 Bundle size reportCompared against
|
| dist | raw | gzip |
|---|---|---|
| JS (runtime) | 1.6 MB (-30 KB) | 575 KB (-12 KB) |
| Type declarations | 495 KB (-8.6 KB) | 179 KB (-3.8 KB) |
| Source maps | 3.1 MB (-56 KB) | 1.0 MB (-21 KB) |
| Other | 11 KB | 3.7 KB |
| Total | 5.2 MB (-95 KB) | 1.8 MB (-37 KB) |
Per-entry composition (own code — deps external (as shipped))
| Entry | Initial (gz) | Lazy (gz) | Total (gz) | node_modules (min) | Own code (min) |
|---|---|---|---|---|---|
. |
118 KB (+5 B) | 2.4 KB | 121 KB (+5 B) | external | 378 KB (+7 B) |
./beta |
127 KB (+251 B) | 4.6 KB (+5 B) | 132 KB (+256 B) | external | 383 KB (+821 B) |
./beta/database-tooling |
62 KB (+243 B) | 0 B | 62 KB (+243 B) | external | 187 KB (+1.0 KB) |
./testing |
47 KB (+3 B) | 38 KB (+4 B) | 85 KB (+7 B) | external | 246 KB (+7 B) |
./tsdown |
630 B | 0 B | 630 B | external | 1.0 KB |
./type-generator |
31 KB (+5 B) | 0 B | 31 KB (+5 B) | external | 89 KB (+7 B) |
Chunks:
| Entry | Chunk | Load | Size (gz) |
|---|---|---|---|
. |
index.js |
initial | 114 KB |
. |
utils.js |
initial | 4.6 KB |
. |
remote-tunnel-manager.js |
lazy | 2.4 KB |
./beta |
beta.js |
initial | 101 KB |
./beta |
stream-manager.js |
initial | 5.9 KB |
./beta |
define-schema.js |
initial | 5.9 KB |
./beta |
service-context.js |
initial | 4.3 KB |
./beta |
modular.js |
initial | 3.6 KB |
./beta |
databricks.js |
initial | 3.3 KB |
./beta |
wide-event-emitter.js |
initial | 2.8 KB |
./beta |
client.js |
initial | 645 B |
./beta |
index.js |
initial | 20 B |
./beta |
index.js |
lazy | 4.1 KB |
./beta |
supervisor-api.js |
lazy | 201 B |
./beta |
databricks.js |
lazy | 188 B |
./beta |
index.js |
lazy | 124 B |
./beta/database-tooling |
index.js |
initial | 62 KB |
./testing |
manifest.js |
initial | 33 KB |
./testing |
index.js |
initial | 10 KB |
./testing |
wide-event-emitter.js |
initial | 2.9 KB |
./testing |
index.js |
lazy | 34 KB |
./testing |
remote-tunnel-manager.js |
lazy | 2.4 KB |
./testing |
utils.js |
lazy | 1.8 KB |
./tsdown |
index.js |
initial | 630 B |
./type-generator |
index.js |
initial | 31 KB |
@databricks/appkit-ui
npm tarball (packed): 393 KB (-4 B) — gzipped download (dist + bin; excludes release-only docs/NOTICE).
| dist | raw | gzip |
|---|---|---|
| JS (runtime) | 430 KB | 146 KB |
| Type declarations | 250 KB | 93 KB (-1 B) |
| Source maps | 837 KB | 281 KB |
| CSS | 16 KB | 3.2 KB |
| Total | 1.5 MB | 522 KB (-1 B) |
Per-entry composition (consumer bundle — deps bundled, peerDeps external)
| Entry | Initial (gz) | Lazy (gz) | Total (gz) | node_modules (min) | Own code (min) |
|---|---|---|---|---|---|
./js |
5.3 KB | 49 KB | 55 KB | 208 KB | 14 KB |
./js/beta |
2.4 KB | 0 B | 2.4 KB | 0 B | 5.3 KB |
./react |
441 KB | 49 KB | 489 KB | 1.4 MB | 180 KB |
./react/beta |
13 KB | 0 B | 13 KB | 25 KB | 13 KB |
Chunks:
| Entry | Chunk | Load | Size (gz) |
|---|---|---|---|
./js |
index.js |
initial | 5.2 KB |
./js |
chunk |
initial | 120 B |
./js |
apache-arrow |
lazy | 49 KB |
./js/beta |
beta.js |
initial | 2.4 KB |
./react |
index.js |
initial | 439 KB |
./react |
tslib |
initial | 2.1 KB |
./react |
apache-arrow |
lazy | 49 KB |
./react/beta |
beta.js |
initial | 13 KB |
Contributor
🤖 AppKit PR bot🔬 Run evalsStart an eval for this PR from the evals-monitor app: Go to Evals Monitor → 📦 Try this PR's app templateScaffolds a new app from this PR's SDK build. Run it in any folder (requires the GitHub CLI — gh run download 45843177193 -R databricks/appkit -n appkit-template-0.105.0-pr.9c91582-stack-database-dev-flow-03-db-migrate-666 -D appkit-pr-666 \
&& unzip -o "appkit-pr-666/appkit-template-0.105.0-pr.9c91582-stack-database-dev-flow-03-db-migrate-666.zip" -d "appkit-pr-666" \
&& databricks apps init --template "appkit-pr-666"The template pins |
This was referenced Oct 14, 2026
ditadi
force-pushed
the
stack/database-dev-flow/03-db-migrate
branch
from
October 19, 2026 12:44
9f3a34f to
1827ebd
Compare
ditadi
force-pushed
the
stack/database-dev-flow/03-db-migrate
branch
from
October 20, 2026 12:23
df1b1c9 to
0d1dfaf
Compare
This was referenced Oct 20, 2026
Draft
… flow `appkit db` gives each developer a Lakebase branch of their own and the commands that write, apply and check migrations there. The command group is hidden from `appkit --help`, and its logic ships in `@databricks/appkit/beta/database-tooling`, which only the AppKit CLI of the same release imports. drizzle-kit is an optional peer that only the tooling loads, and a lint rule keeps runtime code from importing the tooling. What ships: - `migrate`: writes the migration when schema.ts changed, regenerates database.d.ts and database-operations.d.ts, and applies pending migrations to your own branch only. It holds the checkout's history lock, checks the drizzle-kit version, warns about statements that break the previous release or may fail on existing rows, refuses a branch databricks.yml deploys to, and connects only with PGSSLMODE=require. - `introspect`: writes schema.ts and a 0000_baseline (or NNNN_introspect) from existing tables, keeps the old schema.ts as schema.ts.bak and its private columns, records the baseline with compare-and-set, and refuses a migration that would drop objects schema.ts cannot express. - `init`, `clean`, `seed`: dev and session branches with no prompts, an untouched fork copy rebuilt without its app rows, the hand-off of the app schema, atomic .env writes, and the drizzle-kit install. - `verify`: the local check of your branch, and `--deployed` for a target's deployed app and the migrations in its source. - `check`: the offline check of the committed migrations that CI runs. - Startup errors that name the `appkit db` command to run, and the runtime exports the commands use. - The plugin docs for the development flow, with the deploy, failure, backfill and stuck-start runbooks and the CI section, and the design doc passages for these commands. - The template's .gitignore entries for the files the commands write. Co-authored-by: Isaac <no-reply@databricks.com> Signed-off-by: ditadi <victordperd@gmail.com>
…d in appkit db Comments in the db tooling, the db CLI commands and the runtime helpers they added that restated a name, narrated the next lines or argued about our own code are gone. Comments that explain a foreign constraint (Postgres, pg, dotenv, drizzle-kit, the Databricks CLI and APIs, Node) stay as they were. Where a comment carried meaning a name should, the name now carries it: - MigrationDrift.unknown is unknownRecordedCount, as on ApplyMigrationsResult, and readMigrationDrift is readMigrationDriftUnlocked. - SchemaDiagnosis.advice and LocalVerifyReport.schemaAdvice are both tablesInPublicAdvice, and SchemaCheck.absent is absentTables. - CleanReport.kept is keptOwnedByOthers, UnappliedMigration is UnappliedMigrationError, shortName is resourceId as in the tooling, the loader option showImportError is keepImportErrorAsCause, and parseJournal's label is nameInError. - One exported CERT_VERIFYING_SSL_MODE replaces the pool's "require" and init's TLS_MODE. Behavior-preserving extractions replace the prose that explained the control flow: publishJournal and unpublishJournal name the journal write and its restore, shouldDiscardGenerated holds migrate's discard decision, the introspect fixture answers by the exported catalog SQL constants, and the contract check is toolingMatchesCliContract. The migrate command test sets isTTY instead of relying on the worker having none. The plugin doc's Basic usage points local development at appkit db migrate, and Migrations on deploy no longer says scaffolded apps set the flag, which holds only once the template ships it. Co-authored-by: Isaac <no-reply@databricks.com> Signed-off-by: ditadi <victordperd@gmail.com>
ditadi
changed the base branch from
stack/database-dev-flow/02-default-app-schema
to
stack/database-dev-flow/01-migrations-on-deploy
November 26, 2026 14:50
ditadi
added a commit
that referenced
this pull request
Nov 26, 2026
…ionals from one table The health-check note in app.yaml.tmpl and the usage note in the scaffolded schema.ts are gone. README.md.tmpl and the plugin doc carry the same content, and the app.yaml note rendered into every app, with or without the plugin. The smoke test's three copies of the strip-a-conditional block are one table of named patterns run by one loop. It scaffolds byte-identical output with and without --all-plugins. The design doc's Background and Flag Strategy name the three PRs, #654, #666 and #675, instead of the closed ones. Migrations on deploy says again that scaffolded apps set APPKIT_DB_MIGRATE_ON_START, which holds once this PR ships the template. Co-authored-by: Isaac <no-reply@databricks.com> Signed-off-by: ditadi <victordperd@gmail.com>
ditadi
force-pushed
the
stack/database-dev-flow/03-db-migrate
branch
from
November 26, 2026 14:51
6edeb03 to
0cae6bf
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #654. The design is #677.
This PR absorbs #670 (
introspect), #672 (init,cleanandseed), #674 (verify) and #678 (check). It also takes the CLI parts of the old #675: theverifywarning for a.envbranch that is not yours, and the plugin docs for the development flow.What did you change, and why?
#654 applies committed migrations when the deployed app starts, so something has to write those migrations and try them first. This PR is for the developer or agent who edits
config/database/schema.ts. They get a Lakebase branch of their own and one command per step, with no prompts, so a script or an agent can run the whole loop and read each error. CI gets an offline check of the committed history.appkit dbships seven commands:initpoints.envat yourdev-<you>-<hash>branch, or with--sessionat asession-<user hash>-<id>branch that expires after 7 days (--ttlchanges that). It forks from the branch the defaultdatabricks.ymltarget binds, or from the project's default branch when that target does not resolve, and says which. It makes sure the branch has a read-write endpoint that suspends after 5 idle minutes and your Postgres role withDATABRICKS_SUPERUSER, then hands you the app schema when the fork copied it owned by another role. A fresh copy is rebuilt from the migrations, so its app tables start empty.--schema migrateor--schema introspectkeeps the copied rows,--schema cleanremoves them, and--schema nonetouches nothing. init installs the pinned drizzle-kit for every start exceptnone.migratewrites the next migration fromschema.tswith drizzle-kit, regeneratesdatabase.d.tsanddatabase-operations.d.tsundershared/appkit-types, and applies pending migrations to your own dev or session branch. On any other branch it still writes the migration and says why it applied nothing. It warns about statements that break the previous release, such as drops, renames, type changes and a required new column, and about statements that may fail on rows the deploy branch has. When Postgres rejects the migration it just wrote, it removes that migration and restores the journal, so the next run writes it again.introspectwritesschema.tsfrom an existing Postgres schema, keeps the old file asschema.ts.bakand the.private()columns it declared, and writes the migration that matches the database, a first0000_baselineor the nextNNNN_introspect. It records that migration as applied with a compare-and-set. It refuses a migration that would drop whatschema.tscannot express, and warns about indexes and constraints that a database built from the migrations will not have.cleandrops the app schema and its journal in one transaction. Onpublicit drops only what your role owns.clean --delete-branchdeletes this checkout's session branch.seedrunsconfig/database/seed.sqlin one transaction.verifychecks your branch in one read-only transaction that it rolls back. It reports declared tables and columns the branch lacks, unapplied, stranded, edited and unknown migrations, and, on your own branch, a fork copy thatinithas not rebuilt.verify --deployed -t <target>reads only the Databricks API. It checks that the target's app exists and runs, is bound to the target's branch and database withCAN_CONNECT_AND_CREATE, and has a role on the branch. It also checks that the source snapshot of the active deployment has every committed migration with the same journal entry and byte-identical SQL. It refuses when the target'sworkspace.hostis not the workspace the shell is authenticated against.checkis the offline check of the committed migrations that CI runs. It needs no Databricks or Lakebase credentials. Among other findings, it fails whenschema.tschanged without a migration, when the journal is out of order or an entry'sidxis not its position, when a snapshot does not follow the one before it, which happens when two git branches each add a migration, and when a migration file is missing or unlisted. Each finding names its fix.The commands share these rules:
databricks.ymltarget, everypostgresresource, the filesinclude:names, and each target'svariable-overrides.json. A branch any of them binds takes no writes. A reference those files cannot resolve refuses the write and names the reference.config/database/.appkit-db.lock, created exclusively with mode 0600. A second command in the checkout fails and names the holder..envis written with mode 0600 through a temporary file, and a symlinked.envis refused. A connection needsPGHOSTto be a host ofLAKEBASE_ENDPOINT, and refuses aPGSSLMODEthat does not verify the server's certificate.Packaging and runtime:
@databricks/appkit/beta/database-tooling, which only the AppKit CLI of the same release imports. drizzle-kit is an optional peer dependency pinned to0.31.10, and only the tooling loads it. An oxlint rule stops runtime code inpackages/appkit/srcfrom importing the tooling or drizzle-kit.npx appkit db migrate. The ownership error now also says to rerunappkit db initon a dev or session branch.template/_gitignorelists the files the commands write.What this PR does not do:
appkit dbstays hidden fromappkit --help.APPKIT_DB_MIGRATE_ON_STARTyet. The docs say to add it to theenvofapp.yaml, and feat(appkit): render the database development flow in the app template #675 adds it for scaffolded apps.--var,BUNDLE_VAR_*or resources defined in Python, and it does not replace Lakebase permissions.How do you know it works?
targets.test.tsandguard.test.tscover every binding kind, overrides, included files and unresolved references.history-lock.test.tscovers how the lock is taken, released and reported when stale.init.test.tscovers branch creation and reuse, TTLs, a 403, a 409, the branch limit, the refusals before any API call, the hand-off and each--schemastart.verify.test.tsruns--deployedwith no role on the deploy branch and asserts that no database connection or write happens.check.test.tsgenerates real history with drizzle-kit, with every Databricks and Lakebase call throwing.*.pg.test.tssuites run against Postgres. They cover a migration that fails on existing rows and is removed, whatcleantakes with CASCADE, what blocks a role delete, the catalog reads, init's hand-off and rebuild of a fork copy, and howverifyreports a copy.dbtests cover output, prompts and exit codes, andcontract.test.tschecks that the tooling matches the CLI's contract.pnpm build,pnpm -r typecheck,pnpm check,pnpm test(385 files and 7217 tests passed, 1 skipped),CI=1 pnpm exec vitest run packages/shared/src/cli/commands/db(5 files, 66 tests) andpnpm docs:buildpassed. They ran one commit before a one-line fix to the design doc's Flag Strategy table, and the head differs from that commit only in that line.load-routes.watch.test.ts, a watcher test from main, timed out once. It passed on rerun, alone and in the full suite.throw,warn,info,okorfailcall changed. Tests changed only to follow the renames, andmigrate.test.tsnow setsisTTYitself.appkit dbchanges, and that line is fixed. The cleanup reviewer found nothing.bundle-size-baseline.jsonrecords the new@databricks/appkitsize. The packed tarball grows from 1,454,413 to 1,638,260 bytes (+12.6%), mostly from the new./beta/database-toolingentry (63 KB gzipped). It was measured before the comment cleanup, which only shrinks the package.currentUser.me, endpoint and branch lookups, the Apps API'spostgresresource format, a missing app's 404, a deployment'ssource_code_pathandgetHost, all live and read-only. On 2026-11-15, a throwaway Lakebase fork confirmed that the developer role can write the service principal's rows but cannot alter its tables.This revision was not run against a real Lakebase workspace. Nobody has observed who owns
publicon a real Lakebase branch, or checked thatworkspace/exportwithformat=AUTOreturns a file's exact bytes. If it does not,verify --deployedreports the migration as changed, which fails closed. The design's done criteria for this PR, a developer'sinit,migrateandverifyon a throwaway app, and two parallel migrations thatcheckfails, are still open.This pull request and its description were written by Isaac.