drizzle-team / drizzle-team/drizzle-orm

[BUG]: Migrations dropping tables does not consider dependents

Open
#2,575 3 comments 0 reactions 0 assignees View on GitHub
bug drizzle/kit priority
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### 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;
3. _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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.