You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(stack-drizzle): emit unqualified eql_v3 domain so drizzle-kit DDL is valid (rc.2 M5) (#688)
* fix(stack-drizzle): emit unqualified eql_v3 domain so drizzle-kit DDL is valid (rc.2 M5)
A v3 encrypted column declared its SQL type as the schema-qualified domain
(`public.eql_v3_text_search`). drizzle-kit wraps a customType's whole `dataType()`
string in one pair of double quotes, so `generate`/`push` emitted the invalid
identifier `"public.eql_v3_text_search"` — Postgres reads that as a single dotted
type name and rejects it (`type "public.eql_v3_text_search" does not exist`).
Reproduced against drizzle-kit 0.30.6: CREATE TABLE and ADD COLUMN both emit the
broken quoted form; generated migrations needed hand repair.
Fix: `makeEqlV3Column` now emits the BARE domain (`eql_v3_text_search`) via
`stripDomainSchema`, which drizzle-kit renders as the valid `"eql_v3_text_search"`
and which resolves through the search_path (the domains live in `public`). This
mirrors the v2 `encryptedType` surface, which already emits its bare type for the
same reason, and it matches what drizzle-kit introspection reads back on a `push`
diff so the two sides stop disagreeing (the `"undefined"."public.eql_v3_*"` mode).
Builder recovery is unchanged in identity: `getSqlType()` re-qualifies a bare name
back to the canonical `public.eql_v3_*` before matching the recovery keys, and it
still accepts an already-qualified name (test doubles / introspected snapshots),
so operators and schema extraction see the same domain as before.
- Regression guard: every V3_MATRIX domain's `getSQLType()` is asserted dot-free.
- Bare-getSQLType recovery test added alongside the existing qualified one.
- stash-drizzle skill updated to describe the unqualified generated type + the
search-path requirement.
Tests: stack-drizzle 370 unit green, test:types clean, build + biome clean.
Changeset: stack-drizzle patch + stash patch (skill ships in the tarball).
Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w
* fix(stack-drizzle): assert eql_v3 domains live in public before stripping schema
`makeEqlV3Column` emits the bare domain name because drizzle-kit wraps a
customType's whole `dataType()` return in one pair of quotes, so a qualified
`public.eql_v3_text_search` would emit the invalid identifier
`"public.eql_v3_text_search"`. Stripping the `public.` schema is only safe
because every domain lives in `public` — `stripDomainSchema`/`qualifyDomain` are
inverses over exactly that set.
If a domain ever lived in another schema, `stripDomainSchema` would pass its
qualified name through untouched and drizzle-kit would silently emit the invalid
dotted identifier again. Assert the invariant at column construction so that day
fails loudly with an actionable message instead of shipping a broken migration.
Addresses the schema-qualification review notes on #688.
Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w
Copy file name to clipboardExpand all lines: skills/stash-drizzle/SKILL.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,7 +66,7 @@ CREATE TABLE users (
66
66
);
67
67
```
68
68
69
-
You don't usually hand-write this: the `types.*` factories below emit the domain as the column's SQL type, so `drizzle-kit generate` produces the `ADD COLUMN email public.eql_v3_text_search` DDL for you.
69
+
You don't usually hand-write this: the `types.*` factories below emit the domain as the column's SQL type, so `drizzle-kit generate` produces the `ADD COLUMN "email" "eql_v3_text_search"` DDL for you. The generated type is **unqualified** (`eql_v3_text_search`, not `public.eql_v3_text_search`): drizzle-kit wraps a custom type's whole name in one pair of quotes, which would turn a schema-qualified name into the invalid identifier `"public.eql_v3_text_search"`. The bare name resolves via the search path because the domains live in `public` — so keep `public` on the search path (the default), and don't hand-edit the generated type back to a qualified name.
0 commit comments