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

[BUG]: Recreating pg index in version 0.31(orm) + 0.22(kit) fails #2470

Closed
AlonMiz opened this issue Jun 7, 2024 · 3 comments
Closed

[BUG]: Recreating pg index in version 0.31(orm) + 0.22(kit) fails #2470

AlonMiz opened this issue Jun 7, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@AlonMiz
Copy link

AlonMiz commented Jun 7, 2024

What version of drizzle-orm are you using?

0.31.1

What version of drizzle-kit are you using?

0.22.4

Describe the Bug

after migrating to v0.31 it tries to recreate the indexes I have (pg)

The generated migration

DROP INDEX IF EXISTS "orgIdIndex";--> statement-breakpoint
DROP INDEX IF EXISTS "cardTypeIdIndex";--> statement-breakpoint
DROP INDEX IF EXISTS "nameIndex";--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "orgIdIndex" ON "Cards" USING btree (orgId);--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "cardTypeIdIndex" ON "Cards" USING btree (cardTypeId);--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "nameIndex" ON "Cards" USING btree (name);

Error

CREATE INDEX IF NOT EXISTS "orgIdIndex" ON "Cards" USING btree (orgId);
🛢 rollback
🛢  DB - Database migration failed error: column "orgid" does not exist
    at /node_modules/pg/lib/client.js:526:17
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /.next/server/chunks/node_modules_drizzle-orm_9f263b._.js:4065:25
    at async NodePgSession.transaction (/.next/server/chunks/node_modules_drizzle-orm_9f263b._.js:5900:28)
    at async PgDialect.migrate (/.next/server/chunks/node_modules_drizzle-orm_9f263b._.js:4061:9)
    at async migrate (/.next/server/chunks/node_modules_drizzle-orm_9f263b._.js:69:5)
    at async migrateDb (/.next/server/chunks/_0508b7._.js:1474:9)
    at async POST (/.next/server/chunks/_0508b7._.js:1516:9)
    at async /node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:53446

my guess is that the query executes with lowercase, and my column is mixed. (orgId !== orgid)

Expected behavior

i would expect the recreation of the index to succeed

Environment & setup

mac + next js 14+ pg + drizzle

@AlonMiz AlonMiz added the bug Something isn't working label Jun 7, 2024
@AlonMiz AlonMiz changed the title [BUG]: Recreating pg index in version 0.31 fails [BUG]: Recreating pg index in version 0.31(orm) + 0.22(kit) fails Jun 7, 2024
@AndriiSherman AndriiSherman self-assigned this Jun 7, 2024
@AndriiSherman
Copy link
Member

fixing!

@AndriiSherman
Copy link
Member

Should be fixed in [email protected]

@AlonMiz
Copy link
Author

AlonMiz commented Jun 7, 2024

Wow! Thanks @AndriiSherman you are doing some great work! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants