We're starting a new project and we've used Drizzle for the past two weeks and started having issues around migrations. For example, if we wanted to remove a table, removing the drizzle schema def doesn't generate a migration for it.
What's worse is there's no traditional up / down migration for those familiar with knex. There's no "down" at all from what we saw.
There is an issue opened on Drizzle about it and they say they've started work on an up/down migrator, but who knows when that will be done.
So I've spent the past day converting everything to Kysely instead. ChatGPT was pretty good about converting from Drizzle to Kysely if you fed it the Drizzle schema and repository code.
In terms of developer experience, (maybe we didn't play around with it enough), Drizzle returns things as arrays in postgres, whereas in Kysely you can have it return a single item (or throw it if you want if it can't be found) instead of an array. It's a slight annoyance to have to de-structure the results in drizzle for a single item.
Overall for us, the deal-breaker was the sub-par and too-magical migrations in Drizzle. If you wanted to write custom business logic for your migration, it seems like you had to write it in the generated SQL files directly.
Compare this to Kysely, where you have a knex-style up/down and can write your business logic and migration changes in Typescript.
Drizzle Studio via drizzle-kit, however, is pretty great, and we're continuing to use that since it doesn't require any drizzle-specific schema defs to work.
I would recommend Kysely over Drizzle at this point in time and re-evaluate once Drizzle has a better experience around migrations.
I tried Kysely while evaluating libraries before writing my own. Its heavy reliance on strings for everything was a turn-off because it stops you from using any of the refactoring options Typescript offers. You cannot rename a column for example and have it applied automatically.
What's worse is there's no traditional up / down migration for those familiar with knex. There's no "down" at all from what we saw.
There is an issue opened on Drizzle about it and they say they've started work on an up/down migrator, but who knows when that will be done.
https://github.com/drizzle-team/drizzle-orm/discussions/1339
So I've spent the past day converting everything to Kysely instead. ChatGPT was pretty good about converting from Drizzle to Kysely if you fed it the Drizzle schema and repository code.
In terms of developer experience, (maybe we didn't play around with it enough), Drizzle returns things as arrays in postgres, whereas in Kysely you can have it return a single item (or throw it if you want if it can't be found) instead of an array. It's a slight annoyance to have to de-structure the results in drizzle for a single item.
Overall for us, the deal-breaker was the sub-par and too-magical migrations in Drizzle. If you wanted to write custom business logic for your migration, it seems like you had to write it in the generated SQL files directly.
Compare this to Kysely, where you have a knex-style up/down and can write your business logic and migration changes in Typescript.
Drizzle Studio via drizzle-kit, however, is pretty great, and we're continuing to use that since it doesn't require any drizzle-specific schema defs to work.
I would recommend Kysely over Drizzle at this point in time and re-evaluate once Drizzle has a better experience around migrations.