-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Progressively migrate from knex to kysely. #630
Comments
You should be able to use knex and Kysely side by side in the same project without any issues. The only thing I can think of, off the top of my head is that, depending on the setup, you might end up with two connection pools. That might not be an issue, but something to keep in mind. Knex uses it's own connection pool, so there's no way to share that with Kysely currently. We could in theory create a |
I did a small patch to work with same connection until I move completely to kysely.
|
At my company we started migrating from knex to Kysely last week, everything was going fine until today, the file with the generated types is pretty long and the autocomplete stopped working (it was working fine last week), my senior is testing different TS versions and some other stuff |
How many tables? |
Currently 629 tables, the generated types file is approximately 9.5k lines long, we're currently using typescript 5.3.3. |
Try splitting - e.g. kysely-codegen has a filter argument. There's no healthy way a single service should know all tables. |
We spent the afternoon investigating this issue. Whenever i started a fresh file autocomplete worked just fine (even with 629 tables generated), as soon as finished and saved, closed the files, reloaded window (VSCode) and reopened the TS file the autocomplete stayed as "loading..." Then we applied your mentioned filter, generated tables we're reduced to 49, i recreated the same file, tested it again, working fine, sometimes it gets a little slow to load the autocomplete but its pretty ok, it looks like as the file gets bigger the autocomplete gets slower (already felt it slower with 2 simple select queries). Thanks igalklebanov |
We've published https://github.com/kysely-org/kysely-knex, give it a try. Let us know how it went! |
@koskimas @igalklebanov How would you suggest we migrate existing database migrations managed by knex if we want to migrate to kysely? Edit: to be more specific, how would you suggest we handle the transition from our existing |
The easy way - just delete the old migrations and start anew. |
v0.2 released with a custom migration source that allows using Kysely in Knex-managed migrations, side-by-side with Knex. |
@igalklebanov wow, thanks so much! Will check it out with our team soon 🙂 |
Has anyone done this before? Just wondering if there is anything I should be aware of that might cause issues? I thought about keeping my knex schema migrations until all queries are transitioned over while using kysely-codegen for types.
Perhaps a knex -> kysely migration guide in the docs a codemod would be a good idea?
The text was updated successfully, but these errors were encountered: