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.02k stars 553 forks source link

[FEATURE]: Use YYYYMMDDHHMMSS instead of XXXX prefix for migrations? #2588

Open DougSchmidt-Leeward opened 2 months ago

DougSchmidt-Leeward commented 2 months ago

Describe what you want

We have a team of 6 developers all trying to contribute schema changes in parallel and we often collide with merge conflicts.

The 6 devs are all making changes in unrelated areas of the DB, so aside from the conflicts in migrations/meta/_journal.json the work is actually isolated.

Compare this workflow to the Rails ActiveRecord migration pattern, which uses a UTC timestamp as a unique number. In that workflow, the chance of a merge conflict with 6 devs is much less.

From what I can see in the source, both Drizzle and Rails would apply missing migrations in the correct order, skipping migrations already applied. So using the Rails approach would be a nice DX improvement.

Our team still likes using Drizzle, and we will continue to just rebase and workaround this, but I thought I'd highlight an unexpected pain point that we are hitting as development increases.

Wundero commented 2 months ago

This will likely be addressed in 0.32 and beyond (see https://github.com/drizzle-team/drizzle-orm/releases/tag/v0.32.0-beta for the beta release).