Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raw sql`` function calls get incorrectly changed #549

Open
FadhiliNjagi opened this issue Aug 17, 2024 · 0 comments
Open

Raw sql`` function calls get incorrectly changed #549

FadhiliNjagi opened this issue Aug 17, 2024 · 0 comments

Comments

@FadhiliNjagi
Copy link

I am using nanoid in PostgreSQL. I have included it as an SQL function or stored procedure.

My original schema.ts:

export const user = pgTable('_user', {
  id: char('id', { length: 21 }).default(sql`nanoid(21, '6789BCDFGHJKLMNPQRTWbcdfghjkmnpqrtwz')`).primaryKey().notNull(),
  // ...
})

What Drizzle Studio shows in schema tab:

export const user = pgTable("_user", {
  id: char("id", { length: 21 }).default(nanoid(21, '6789BCDFGHJKLMNPQRTWbcdfghjkmnpqrtwz'::text)).primaryKey().notNull(),
  // ...
})

Obviously, there I have no nanoid function in my TS code. I can't edit the schema tab to make Drizzle kit studio aware of the correct schema so I can test my drizzle queries on Drizzle Runner.

Any help would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant