Bug Report: Drizzle-kit Introspection Failed to Declare Default Value in SQL

Table introspection fails to find a type declaration for a default value.
ref_icon character varying(255) COLLATE pg_catalog."default" DEFAULT 'activity'::character varying,
ref_icon character varying(255) COLLATE pg_catalog."default" DEFAULT 'activity'::character varying,
Automatic SQL import does not occur and it imports without declaring it to be raw SQL.
import { sql } from 'drizzle-orm';
import { sql } from 'drizzle-orm';
As a result several errors are created in the imported schema.
refIcon: varchar("ref_icon", { length: 255}).default('activity'::character varying`),
refIcon: varchar("ref_icon", { length: 255}).default('activity'::character varying`),
Solution: Introspection must import SQL and make the statement as evidenced in the Documentation:
refIcon: varchar("ref_icon", { length: 255 }).default(
sql`'activity'::character varying`,
),
refIcon: varchar("ref_icon", { length: 255 }).default(
sql`'activity'::character varying`,
),
https://orm.drizzle.team/docs/indexes-constraints
Drizzle ORM - Indexes & Constraints
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
1 Reply
BluePin
BluePinOP10mo ago
Github Issue #2069
GitHub
[BUG]: Drizzle-kit Introspection Failed to Declare Default Value in...
What version of drizzle-orm are you using? 0.29.4 What version of drizzle-kit are you using? 0.20.14 Describe the Bug Table introspection fails to find a type declaration for a default value. ref_i...
Want results from more Discord servers?
Add your server