The drizzle-kit push command fails when using a Postgres database if a table has a composite primary key and it's name includes a "-".
This issue appears to be due to the CONSTRAINT name not being wrapped with quotes:
> drizzle-kit push
drizzle-kit: v0.21.4
drizzle-orm: v0.30.10
No config path provided, using default path
Reading config file '/Users/jasongerbes/Documents/GitHub/test-app/drizzle.config.ts'
Using '@vercel/postgres' driver for database querying
[Warning] '@vercel/postgres' can only connect to remote Neon/Vercel Postgres/Supabase instances through a websocket
[✓] Pulling schema from database...
Warning You are about to execute current statements:
ALTER TABLE "example-table" DROP CONSTRAINT example-table_userId_credentialID_pk;
--> statement-breakpoint
ALTER TABLE "example-table" ADD CONSTRAINT example-table_userId_credentialID_pk PRIMARY KEY(userId,credentialID);
error: syntax error at or near "-"
Expected behavior
The drizzle-kit push command should wrap CONSTRAINT names in quotes to prevent issues due to the inclusion of "-" in a table's name.
What version of
drizzle-orm
are you using?0.30.10
What version of
drizzle-kit
are you using?0.21.4
Describe the Bug
The
drizzle-kit push
command fails when using a Postgres database if a table has a composite primary key and it's name includes a "-".This issue appears to be due to the
CONSTRAINT
name not being wrapped with quotes:Expected behavior
The
drizzle-kit push
command should wrapCONSTRAINT
names in quotes to prevent issues due to the inclusion of "-" in a table's name.Environment & setup
Example table schema:
Reproduction steps:
drizzle-kit push
drizzle-kit push
again