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]: DROP on INDEX does not include PG Schema prefix #3703

Open
1 task done
Yatsuko opened this issue Dec 6, 2024 · 0 comments · May be fixed by #3866
Open
1 task done

[BUG]: DROP on INDEX does not include PG Schema prefix #3703

Yatsuko opened this issue Dec 6, 2024 · 0 comments · May be fixed by #3866
Labels
bug Something isn't working db/postgres drizzle/kit priority Will be worked on next

Comments

@Yatsuko
Copy link

Yatsuko commented Dec 6, 2024

Report hasn't been filed before.

  • I have verified that the bug I'm about to report hasn't been filed before.

What version of drizzle-orm are you using?

0.37.0

What version of drizzle-kit are you using?

0.29.1

Other packages

No response

Describe the Bug

When removing a previously created index on the schema definition (it's important that this is done on a definition with a prefix other than the default "public") and generating a migration using drizzle-kit, the generated SQL does not include the pg schema prefix for the tables. This results in a not found index and then a not-deleted/dropped index which can lead to unwanted or broken behaviour.

A sample generated SQL (even if the db schema prefix is something like "db2") would be:
DROP INDEX IF EXISTS "table_vaue_1_value_2_index";--> statement-breakpoint
and should be:
DROP INDEX IF EXISTS "db2"."table_vaue_1_value_2_index";--> statement-breakpoint

The first version will never find the corresponding index and the migration will falsely run through due to the IF EXISTS.

@Yatsuko Yatsuko added the bug Something isn't working label Dec 6, 2024
@WaciX WaciX linked a pull request Dec 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working db/postgres drizzle/kit priority Will be worked on next
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants