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]: Unique constraint is not added to the change. #2302

Closed
theanh098 opened this issue May 12, 2024 · 4 comments
Closed

[BUG]: Unique constraint is not added to the change. #2302

theanh098 opened this issue May 12, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@theanh098
Copy link

theanh098 commented May 12, 2024

What version of drizzle-orm are you using?

0.30.10

What version of drizzle-kit are you using?

0.21.1

Describe the Bug

When I add a new unique() constraint on a exsited column and then run drizzle-kit push, it was not applied. Furthermore, when I run drizzle-kit generate the output shows No schema changes, nothing to migrate.

Expected behavior

No response

Environment & setup

No response

@theanh098 theanh098 added the bug Something isn't working label May 12, 2024
@AndriiSherman
Copy link
Member

Could you please share some repro example for this case? Would need a schema before and after changes

@achaconm2001
Copy link

Hi @AndriiSherman

I made this repo for the repro example:
https://github.com/achaconm2001/drizzle-unique-error

I placed the schema and some guides on this file:
https://github.com/achaconm2001/drizzle-unique-error/blob/main/schema.ts

The idea is to run bun run generate, then comment the current table definition that doesn't have the unique index and uncomment the definition with the index.

The expected behavior is that the first bun run generate creates the SQL to create that table, and the second bun run generate should add the unique constraint, but it doesn't detect the changes.

@AndriiSherman
Copy link
Member

@achaconm2001 thanks a lot! I have just reproduced it and fixed it. Going to include in next patch release(tomorrow)

@AndriiSherman
Copy link
Member

should be fixed in drizzle-kit@0.21.2. Feel free to reopen if it is not fixed for you!

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

3 participants