Repository navigation
Conversation
ditadi
added this pull request to stack #667
October 13, 2026 13:34
Contributor
📦 Bundle size reportCompared against
|
| dist | raw | gzip |
|---|---|---|
| JS (runtime) | 1.3 MB (+58 KB) | 480 KB (+23 KB) |
| Type declarations | 467 KB (+3.8 KB) | 170 KB (+1.9 KB) |
| Source maps | 2.6 MB (+109 KB) | 896 KB (+40 KB) |
| Other | 11 KB | 3.7 KB |
| Total | 4.4 MB (+171 KB) | 1.5 MB (+64 KB) |
Per-entry composition (own code — deps external (as shipped))
| Entry | Initial (gz) | Lazy (gz) | Total (gz) | node_modules (min) | Own code (min) |
|---|---|---|---|---|---|
. |
106 KB (-1 B) | 2.5 KB (+1 B) | 108 KB | external | 343 KB |
./beta |
108 KB (+5.1 KB) | 485 B | 108 KB (+5.1 KB) | external | 323 KB (+14 KB) |
./database-tooling |
26 KB | 0 B | 26 KB | external | 76 KB |
./testing |
45 KB (+2 B) | 32 KB (-3 B) | 77 KB (-1 B) | external | 223 KB |
./tsdown |
520 B | 0 B | 520 B | external | 813 B |
./type-generator |
26 KB (+1 B) | 0 B | 26 KB (+1 B) | external | 74 KB |
Chunks:
| Entry | Chunk | Load | Size (gz) |
|---|---|---|---|
. |
index.js |
initial | 101 KB |
. |
utils.js |
initial | 4.6 KB |
. |
remote-tunnel-manager.js |
lazy | 2.5 KB |
./beta |
beta.js |
initial | 88 KB |
./beta |
modular.js |
initial | 6.0 KB |
./beta |
stream-manager.js |
initial | 5.9 KB |
./beta |
service-context.js |
initial | 4.2 KB |
./beta |
databricks.js |
initial | 3.3 KB |
./beta |
client.js |
initial | 647 B |
./beta |
index.js |
initial | 20 B |
./beta |
supervisor-api.js |
lazy | 192 B |
./beta |
databricks.js |
lazy | 178 B |
./beta |
index.js |
lazy | 115 B |
./database-tooling |
index.js |
initial | 26 KB |
./testing |
manifest.js |
initial | 32 KB |
./testing |
index.js |
initial | 10 KB |
./testing |
wide-event-emitter.js |
initial | 2.9 KB |
./testing |
index.js |
lazy | 28 KB |
./testing |
remote-tunnel-manager.js |
lazy | 2.5 KB |
./testing |
utils.js |
lazy | 1.8 KB |
./tsdown |
index.js |
initial | 520 B |
./type-generator |
index.js |
initial | 26 KB |
@databricks/appkit-ui
npm tarball (packed): 397 KB (+4 B) — gzipped download (dist + bin; excludes release-only docs/NOTICE).
| dist | raw | gzip |
|---|---|---|
| JS (runtime) | 429 KB | 147 KB |
| Type declarations | 267 KB | 98 KB (+1 B) |
| Source maps | 853 KB | 286 KB |
| CSS | 16 KB | 3.2 KB |
| Total | 1.5 MB | 534 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.1 KB | 0 B | 2.1 KB | 0 B | 5.0 KB |
./react |
433 KB | 49 KB | 481 KB | 1.3 MB | 177 KB |
./react/beta |
4.9 KB | 0 B | 4.9 KB | 0 B | 12 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.1 KB |
./react |
index.js |
initial | 431 KB |
./react |
tslib |
initial | 2.1 KB |
./react |
apache-arrow |
lazy | 49 KB |
./react/beta |
beta.js |
initial | 4.9 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 39422021326 -R databricks/appkit -n appkit-template-0.89.0-pr.b9ff8ab-stack-database-dev-flow-03-db-migrate-666 -D appkit-pr-666 \
&& unzip -o "appkit-pr-666/appkit-template-0.89.0-pr.b9ff8ab-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
`appkit db migrate` generates a migration from config/database/schema.ts with drizzle-kit, regenerates shared/appkit-types/database.d.ts, and applies pending migrations to the branch .env points at. It applies only to a branch created for this developer (dev-…) or this checkout (session-…); on any other branch, including the project default and any branch databricks.yml deploys to, it generates and says why nothing was applied. It connects only after the Lakebase API confirms that PGHOST is a host of LAKEBASE_ENDPOINT. The logic lives in a new @databricks/appkit/database-tooling entry point that the shared CLI loads lazily, so the runtime never imports drizzle-kit. drizzle-kit is an optional peer dependency: apps that generate migrations install it as a dev dependency, and the command says how when it is missing. `appkit db` stays hidden from --help until the database plugin is offered by `databricks apps init`. Signed-off-by: ditadi <victordperd@gmail.com>
A generated migration that fails to apply is removed and the journal restored, so a fix in schema.ts replaces it instead of stacking behind it. Also: refuse a drizzle-kit other than the pinned one or one loading another drizzle-orm, parse the branch and endpoint responses the guard decides on, type the CLI against a contract appkit's typecheck enforces, and enforce the drizzle-kit and tooling import boundary with oxlint. Signed-off-by: ditadi <victordperd@gmail.com>
…nch pool resolveEnvBranch returns the branch kind (default, protected, deploy target, dev, session, other), and takesWrites is the one rule for which kinds take writes. It needs PGHOST, PGDATABASE and LAKEBASE_ENDPOINT, like the pool. withBranchPool opens and always closes the pool. The drizzle-kit v7 file names live only in migrations/paths.ts. Signed-off-by: ditadi <victordperd@gmail.com>
…aks the previous release Apps keeps instances of the previous release serving while the new one migrates on start, and a code rollback cannot undo a migration. When the generated migration drops, renames, retypes or makes a column NOT NULL, the report lists those statements and the CLI says to ship code that works with both schemas first. Signed-off-by: ditadi <victordperd@gmail.com>
…lient Signed-off-by: ditadi <victordperd@gmail.com>
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
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 PR (generated by Stack)
Use this link to review incremental changes.
Stacked on #655. The design is #677.
What did you change, and why?
Why: #654 applies committed migrations when the deployed app starts. Something has to write those migrations and try them first. A developer or an agent has to be able to do that in a loop: change
schema.ts, run one command, read the error, try again, with no hand-editing of drizzle's files.Change:
appkit db migrategenerates the next migration fromconfig/database/schema.tswith drizzle-kit, regeneratesshared/appkit-types/database.d.ts, and applies pending migrations to the branch.envpoints at. The command stays hidden from--helpuntil the last PR of the stack.dev-…) or this checkout (session-…). It refuses the project's default branch, protected branches, another developer's branch, and every branchdatabricks.ymldeploys to. On those it still generates, and says why nothing was applied. The guard parses the Lakebase responses it decides on, so a branch with nostatusfails instead of reading as "not default, not protected"..envbranch to its kind (default, protected, deploy target, dev, session, other), and one rule says which kinds take writes. The later commands in the stack read the same kind..envcounts as configured only withPGHOST,PGDATABASEandLAKEBASE_ENDPOINT, the three the pool needs.NOT NULL, the command lists those statements and warns. Apps keeps instances of the previous release serving while the new one migrates on start, so those statements break them, and a code rollback cannot undo a migration. The warning says to deploy code that works with both schemas first.NOT NULLcolumn on a table with rows), the command removes it and restores the journal. Without that, the failed migration would run first on every later try, and a fix inschema.tswould stack behind it. The error names the SQLSTATE, the removed file, and what to change. If an earlier committed migration fails instead, the new one stays.PGHOSTis a host ofLAKEBASE_ENDPOINT. A mismatch, a missing endpoint, or a failed lookup refuses without connecting. The runtime check in the Lakebase connector only warns and is unchanged.requestfor the Lakebase REST calls, in the API's snake_case, andcurrentUser.mefor the developer's user name. The Lakebase pool refreshes its token through the samerequest.0.31.10. If it is missing, is another version, has no./apiexport, or loads a differentdrizzle-ormfrom AppKit's, generating fails with thenpm installcommand that fixes it.@databricks/appkit/database-tooling, which the shared CLI loads lazily. It is internal to the CLI and has no semver guarantee. oxlint stops runtime code from importing drizzle-kit or the tooling in any form, including dynamic imports, so a deployed app never loads drizzle-kit.sharedcannot depend on appkit, so the CLI types the tooling withDatabaseToolingintooling-contract.ts, and appkit's typecheck checks the real exports against it.How do you know it works?
Testing:
migrations.test.ts: migrations come from the real drizzle-kit and are read back by drizzle-orm's migrator. Renames refuse outside a TTY, a discarded migration restores the previous journal byte for byte, and only drops, renames, type changes and newNOT NULLs count as breaking the previous release.migrate.test.ts: generate, apply, the reasons nothing was applied, a dropped column reported as breaking, and both failure cases: the generated migration failing, and an earlier one failing. The CLI'smigrate.test.tschecks the printed warning.migrate.pg.test.tsruns against Postgres whenAPPKIT_TEST_PG_URLis set. ANOT NULLcolumn on a table with a row fails with23502and is removed. The fixedschema.tsthen applies, and the row keeps its data. With the removal disabled, this test fails.guard.test.ts,lakebase-api.test.tsandcontext.test.ts: each refused branch kind, responses without the fields the guard needs, a host of another branch, one endpoint lookup per connection, a pool closed even when the command fails, and how a Lakebase call becomes a workspace request: the query, the JSON body, and the status of a failed call.drizzle-kit-dependency.test.ts: the missing, mismatched and 1.x drizzle-kit cases, a differentdrizzle-orm, and the peer pin inpackage.json.contract.test.ts: a field added to the contract, or a parameter narrowed in appkit, fails typecheck. I checked both by hand.currentUser.me, an endpoint lookup, and a branch lookup, including a missing branch's 404.migrateitself was not run against a live branch.