drizzle-team / drizzle-kit-mirror

Docs and issues repository for drizzle-kit
288 stars 16 forks source link

`drizzle-kit push` executes bad query for postgres enum types #481

Open erfanium opened 1 week ago

erfanium commented 1 week ago

this is how i defined my enum:

export const transactionProvider = pgEnum("transaction_provider", [
  "zibal",
  "idpay",
  "manual",
]);

output of drizzle-kit push;

$ npx drizzle-kit push
drizzle-kit: v0.22.7
drizzle-orm: v0.31.2

No config path provided, using default path
Reading config file '/home/erfanium/Documents/imed/my-app/drizzle.config.ts'
Using 'pg' driver for database querying
[✓] Pulling schema from database...

 Warning  You are about to execute current statements:

ALTER TYPE "transaction_provider" ADD VALUE 'zibal';

error: enum label "zibal" already exists
    at /home/erfanium/Documents/imed/my-app/node_modules/drizzle-kit/bin.cjs:77696:15
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.query (/home/erfanium/Documents/imed/my-app/node_modules/drizzle-kit/bin.cjs:119635:26)
    at async pgPush (/home/erfanium/Documents/imed/my-app/node_modules/drizzle-kit/bin.cjs:122560:13)
    at async _Command.<anonymous> (/home/erfanium/Documents/imed/my-app/node_modules/drizzle-kit/bin.cjs:129681:7) {
  length: 91,
  severity: 'ERROR',
  code: '42710',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'pg_enum.c',
  line: '264',
  routine: 'AddEnumLabel'
}

I could investigate more If i had access to the source code.

erfanium commented 6 days ago

maybe duplicate of #464