Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[BUG]: Migrations dropping tables does not consider dependents #2575

Open
cybercoder-naj opened this issue Jul 1, 2024 · 2 comments
Open
Labels
bug Something isn't working drizzle/kit priority Will be worked on next

Comments

@cybercoder-naj
Copy link

cybercoder-naj commented Jul 1, 2024

What version of drizzle-orm are you using?

0.31.2

What version of drizzle-kit are you using?

0.22.8

Describe the Bug

The previous schema had 3 tables: users, user_auth, user_session. user_session.userId was a foreign key to user_auth.id. My actions were:

  1. delete the user_auth table.
  2. user_session.userId was a foreign key to users.id.

The migrations were:

  1. DROP TABLE user_auth;
  2. Altering the constraint of user_session.userId.

However, the 1st command errored since user_session depended on user_auth.

Expected behavior

Run proper migrations considering dependents with foreign keys.

Environment & setup

Linux, bun 1.1.17.

@cybercoder-naj cybercoder-naj added the bug Something isn't working label Jul 1, 2024
@L-Mario564
Copy link
Collaborator

@cybercoder-naj What DB are you using?

@L-Mario564 L-Mario564 added drizzle/kit priority Will be worked on next labels Oct 23, 2024
@cybercoder-naj
Copy link
Author

cybercoder-naj commented Oct 23, 2024

I am using PostgreSQL v16.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working drizzle/kit priority Will be worked on next
Projects
None yet
Development

No branches or pull requests

2 participants