Skip to content

chore(database): add internal schema contract and builder foundation#469

Merged
ditadi merged 3 commits into
mainfrom
stack/db-plugin/schema-contract
Jul 3, 2026
Merged

chore(database): add internal schema contract and builder foundation#469
ditadi merged 3 commits into
mainfrom
stack/db-plugin/schema-contract

Conversation

@ditadi

@ditadi ditadi commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds the first AppKit-side foundation for the database plugin.

The broader database plugin goal is to give AppKit apps a typed, Lakebase-backed database lifecycle: developers declare tables in TypeScript, AppKit derives runtime/query metadata from that schema, and later stack layers use the same contract for DDL, migrations, type generation, and DML-only runtime access.

This PR specifically:

  • Adds the database contract types used by the runtime/query layer: column metadata, relation metadata, filter operators, and wire limits.
  • Adds defineSchema(...), table/column builders, FK refs, private/owner column markers, and Drizzle-backed engine table handles.
  • Resolves FK-derived relations in one pass, including forward toOne and inferred reverse toMany relations.
  • Derives Zod insert/update schemas from table metadata.
  • Adds unit coverage for contract serialization, schema building, FK handling, relation inference, engine relation generation, private columns, and validators.

Scope

This is the schema/contract foundation only. It does not add the database plugin runtime, lifecycle CLI commands, migrations, grants, or deploy orchestration; those are layered in later PRs in the stack.

Tests

  • Unit tests added under packages/appkit/src/database/**/tests.

@ditadi ditadi force-pushed the stack/db-plugin/schema-contract branch from f2cd59e to b97e97a Compare July 3, 2026 11:06
@ditadi ditadi changed the title Stack/db plugin/schema contract Add database schema contract and schema builder foundation Jul 3, 2026
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

📦 Bundle size report

Compared against bundle-size-baseline.json (main).

@databricks/appkit

npm tarball (packed): 663 KB (+16 B) — gzipped download (dist + bin; excludes release-only docs/NOTICE).

dist raw gzip
JS (runtime) 689 KB 241 KB
Type declarations 268 KB 91 KB
Source maps 1.3 MB 448 KB
Other 11 KB 3.7 KB
Total 2.3 MB 784 KB
Per-entry composition (own code — deps external (as shipped))
Entry Initial (gz) Lazy (gz) Total (gz) node_modules (min) Own code (min)
. 74 KB 2.5 KB 76 KB external 244 KB
./beta 39 KB 231 B 39 KB external 117 KB
./type-generator 19 KB 0 B 19 KB external 54 KB

Chunks:

Entry Chunk Load Size (gz)
. index.js initial 70 KB
. utils.js initial 4.0 KB
. remote-tunnel-manager.js lazy 2.5 KB
./beta beta.js initial 30 KB
./beta databricks.js initial 5.7 KB
./beta service-context.js initial 3.0 KB
./beta client-options.js initial 219 B
./beta databricks.js lazy 128 B
./beta index.js lazy 103 B
./type-generator index.js initial 19 KB

@databricks/appkit-ui

npm tarball (packed): 297 KB — gzipped download (dist + bin; excludes release-only docs/NOTICE).

dist raw gzip
JS (runtime) 363 KB 120 KB
Type declarations 203 KB 73 KB
Source maps 672 KB 219 KB
CSS 16 KB 3.3 KB
Total 1.2 MB 415 KB
Per-entry composition (consumer bundle — deps bundled, peerDeps external)
Entry Initial (gz) Lazy (gz) Total (gz) node_modules (min) Own code (min)
./js 4.2 KB 49 KB 54 KB 208 KB 11 KB
./js/beta 20 B 0 B 20 B 0 B 0 B
./react 591 KB 49 KB 640 KB 1.8 MB 167 KB
./react/beta 20 B 0 B 20 B 0 B 0 B

Chunks:

Entry Chunk Load Size (gz)
./js index.js initial 4.1 KB
./js chunk initial 120 B
./js apache-arrow lazy 49 KB
./js/beta beta.js initial 20 B
./react index.js initial 589 KB
./react tslib initial 2.1 KB
./react apache-arrow lazy 49 KB
./react/beta beta.js initial 20 B

@ditadi ditadi changed the title Add database schema contract and schema builder foundation feat(database): add schema contract and schema builder foundation Jul 3, 2026
@ditadi ditadi marked this pull request as ready for review July 3, 2026 11:13
@ditadi ditadi requested a review from a team as a code owner July 3, 2026 11:13
@ditadi ditadi requested a review from atilafassina July 3, 2026 11:13
Comment thread packages/appkit/src/database/schema-builder/private.ts
@ditadi ditadi force-pushed the stack/db-plugin/schema-contract branch from b97e97a to 92c5dee Compare July 3, 2026 12:06
@ditadi ditadi changed the title feat(database): add schema contract and schema builder foundation chore(database): add internal schema contract and builder foundation Jul 3, 2026
@ditadi ditadi merged commit c4a4bcb into main Jul 3, 2026
12 checks passed
@ditadi ditadi deleted the stack/db-plugin/schema-contract branch July 3, 2026 12:28
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