feat(database): brownfield support — introspector, drift detection, db CLI - #356
Closed
ditadi wants to merge 13 commits into
Closed
feat(database): brownfield support — introspector, drift detection, db CLI#356ditadi wants to merge 13 commits into
ditadi wants to merge 13 commits into
Conversation
This was referenced May 6, 2026
ditadi
force-pushed
the
stack/database/server
branch
from
May 6, 2026 23:51
bd97e39 to
34f281f
Compare
ditadi
force-pushed
the
stack/database/brownfield
branch
2 times, most recently
from
May 6, 2026 23:54
2a6c38a to
ee90b8e
Compare
ditadi
force-pushed
the
stack/database/server
branch
2 times, most recently
from
May 7, 2026 00:07
b7bf127 to
3d25e45
Compare
ditadi
force-pushed
the
stack/database/brownfield
branch
from
May 7, 2026 00:07
ee90b8e to
35830ad
Compare
ditadi
force-pushed
the
stack/database/server
branch
from
May 7, 2026 01:28
3d25e45 to
caa5080
Compare
ditadi
force-pushed
the
stack/database/brownfield
branch
from
May 7, 2026 01:28
35830ad to
0bcf90a
Compare
…e, drift help dedup
Signed-off-by: ditadi <victordperd@gmail.com>
Signed-off-by: ditadi <victordperd@gmail.com>
…ope verify to declared schema * introspect: when the live DB has no FK constraints, infer relations by matching a column's name and pg_type to another table's PK. Inferred references are tagged so the renderer marks them with "inferred from naming convention; verify" for human review. Resolves .include() silently failing on schemas created without explicit REFERENCES clauses. * render: keep .primaryKey() on columns that are both PK and FK (e.g. 1:1 mapping tables like ai_summaries(case_id)). The FK branch was emitting fk(...).notNull() and dropping the PK marker. * verify: read $schemaName from the loaded defineSchema(...) and pass it to introspect, so drift only scans the Postgres schema this app owns. Eliminates false drift from sibling apps' tables in the same Lakebase database.
ditadi
force-pushed
the
stack/database/brownfield
branch
from
May 15, 2026 11:03
0bcf90a to
7e78b62
Compare
ditadi
force-pushed
the
stack/database/server
branch
from
May 15, 2026 11:03
caa5080 to
1c4c286
Compare
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
Use this link to review incremental changes.
Brownfield support for existing Lakebase/Postgres schemas. This layer lets AppKit inspect a live database, render schema files, detect drift, and manage migrations from the CLI.
Introspection + rendering
Adds the introspector engine, Drizzle adapter, schema-to-introspection bridge, SQL rendering, type mapping, and roundtrip tests.
Drift detection
Adds boot-time drift detection with fatal/warn classifications, production fail-closed behavior for unsafe drift, live-only warnings, healthz saturation, and pg-to-http error mapping.
Database CLI
Adds
appkit db introspect,generate,migrate,verify,setup:dev,seed, and migration helpers.Test plan
PR Stack
appkit db initonboarding — feat(cli): appkit db init — one-command lakebase onboarding #357