-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Report hasn't been filed before.
- I have verified that the bug I'm about to report hasn't been filed before.
What version of drizzle-orm
are you using?
^0.44.2
What version of drizzle-kit
are you using?
0.31.5
Other packages
No response
Describe the Bug
I'm using PostgreSQL.
I have this SQL definition pushed into my DB:
CREATE TABLE "ticketXRRPP" (
"ticketGroupId" UUID NOT NULL,
"rrppId" UUID NOT NULL,
"code" TEXT NOT NULL DEFAULT upper(substr(md5(random()::text), 1, 6)),
"createdAt" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "ticketXRRPP_pkey" PRIMARY KEY ("ticketGroupId")
);
When I run npx drizzle-kit pull, the schema.ts is not typed correctly because upper, substr and md5 are not TS functions:
export const ticketXrrpp = pgTable("ticketXRRPP", {
ticketGroupId: uuid().primaryKey().notNull(),
rrppId: uuid().notNull(),
code: text().default(upper(substr(md5((random())::text), 1, 6))).notNull(),
createdAt: timestamp({ withTimezone: true, mode: 'string' }).default(sql`CURRENT_TIMESTAMP`).notNull(),
}, (table) => [
uniqueIndex("ticketXRRPP_code_key").using("btree", table.code.asc().nullsLast().op("text_ops")),
foreignKey({
columns: [table.ticketGroupId],
foreignColumns: [ticketGroup.id],
name: "ticketXRRPP_ticketGroupId_fkey"
}).onUpdate("cascade").onDelete("cascade"),
foreignKey({
columns: [table.rrppId],
foreignColumns: [user.id],
name: "ticketXRRPP_rrppId_fkey"
}).onUpdate("cascade").onDelete("restrict"),
]);
It should be as following (regarding the code
column):
code: text().default(sql`upper(substr(md5((random())::text), 1, 6))`).notNull(),
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working