drizzle-orm icon indicating copy to clipboard operation
drizzle-orm copied to clipboard

[BUG]: ALTER TABLE needs quotes if there's pascal or camel case

Open colindeclue opened this issue 2 years ago • 1 comments

What version of drizzle-orm are you using?

0.30.7

What version of drizzle-kit are you using?

0.20.14

Describe the Bug

I noticed that when running my migration, it produced some error:

ALTER TABLE "tblOrganizationUsers" DROP CONSTRAINT pkOrganizationUsers; --> statement-breakpoint ALTER TABLE "tblOrganizationUsers" ADD CONSTRAINT pkOrganizationUsers PRIMARY KEY(organizationId,userId,role);

Expected behavior

It worked once I changed it to this: (I added the IF EXISTS, but that's for another bug)

ALTER TABLE "tblOrganizationUsers" DROP CONSTRAINT IF EXISTS "pkOrganizationUsers"; --> statement-breakpoint ALTER TABLE "tblOrganizationUsers" ADD CONSTRAINT "pkOrganizationUsers" PRIMARY KEY("organizationId","userId","role");

Environment & setup

No response

colindeclue avatar Apr 23 '24 19:04 colindeclue

Should work fine on the latest versions, which are 0.32.0 at the time of this message

AndriiSherman avatar Jul 11 '24 09:07 AndriiSherman