drizzle-team / drizzle-orm

Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅
https://orm.drizzle.team
Apache License 2.0
23.54k stars 578 forks source link

[BUG]: Implicit sequences are not tracked in migrations #2567

Open aeons opened 3 months ago

aeons commented 3 months ago

What version of drizzle-orm are you using?

0.31.2

What version of drizzle-kit are you using?

0.22.7

Describe the Bug

Sequences created by using the *serial column types in postgres are not tracked by migrations.

I mistakenly created a reference column with type bigserial rather than bigint. After fixing the mistake and generating the migration that changed the column type, the underlying sequence was not deleted and the default on the column was still in place.

Similarly, renaming a column that has an implicit sequence attached will not rename the sequence.

Expected behavior

I would expect the generated migration to also update the underlying sequences.

Environment & setup

At least when targeting postgres for migrations.