Database migrations
Is there any tool to create migrations with typescript script support? like django or alembic has??
I only found kysely, which has a migration system but you still have to write your own migrations, which seem pretty stupid due to the fact that you have all the types to make it automagically
6 Replies
Both prisma and drizzle can generate migrations
https://orm.drizzle.team/kit-docs/overview
https://www.prisma.io/docs/concepts/components/prisma-migrate
Drizzle Kit - DrizzleORM
Drizzle ORM | %s
Prisma
Prisma Migrate | Database, Schema, SQL Migration Tool
Prisma Migrate is a database migration tool available via the Prisma CLI that integrates with Prisma schema for data modeling.
if its stupid, how about your write one yourself.
thats a agresive and unuseful answer ... thanks a lot for the help 🙂
well using words like "stupid" when mentioning a free open-source project is toxic and just shitty behavior.
but to answer your claims:
1. no, typescript types don't magically translate to sql data types. e.g. a string could be a variety of data types, across 3 (soon 4) supported core dialects.
2. building something like that, as pointless as it is (see 1), would require building a CLI (that uses typescript compiler API - Kysely has no runtime schema) - a CLI is something out of scope for kysely core - its a query builder, not an ORM. hint: there's a kysely migration CLI package in the wild, maybe submit an issue there?
3. there are many solutions on the market that do that and can be combined with Kysely. ones mentioned above, also Ariga's Atlas iirc.
yep i have see the kysely migration cli with the prisma to kysely, it helps