Using UUID v7 with Drizzle?

Can I use UUID V7 or some other sortable ID primary column that is not a easy number?
2 Replies
Mike J
Mike J2mo ago
Hey @DragonCoder99 This has been fine for me in my schema.ts:
export const clients = pgTable("clients", {
id: uuid("id").primaryKey().default(sql`uuid_generate_v7()`)
});
export const clients = pgTable("clients", {
id: uuid("id").primaryKey().default(sql`uuid_generate_v7()`)
});
Don't forget to add the extension first e.g.
CREATE extension pg_uuidv7;
CREATE extension pg_uuidv7;
DragonCoder99
DragonCoder99OP2mo ago
Thanks 👍
Want results from more Discord servers?
Add your server