Is there an easy tool to convert my existing knex migrations to kysely migrations?

I have a bunch of knex migrations in following format:
.createTable("state", (table: Knex.TableBuilder) => {
table.bigIncrements("id").unsigned().primary();
table.string("abbreviation", 2).notNullable();
table.string("name", 100).notNullable();
})
.createTable("state", (table: Knex.TableBuilder) => {
table.bigIncrements("id").unsigned().primary();
table.string("abbreviation", 2).notNullable();
table.string("name", 100).notNullable();
})
Copilot can't seem to do this for me so wondering if anyone knows of a tool? Maybe the only way is by hand.
18 Replies
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
WhyDoThis
WhyDoThis3mo ago
Let me take a look I appreciate it igalk - I am a bit eager though to just rip out knex/objection completely if possible and move on haha.
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
WhyDoThis
WhyDoThis3mo ago
I am pre-release on this project so I think the cost to do this is lowest now then it will be but it is a good point
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
WhyDoThis
WhyDoThis3mo ago
I took a db backup so I can compare to make sure after I convert them they are 1:1 schema wise
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
WhyDoThis
WhyDoThis3mo ago
Yes I maybe phrased it poorly I don't have multiple migration files but all my tables in one knex migration file but knex of course uses things like bigIncrements/string, etc. which are not 1:1 with actual underlying db type names so it is a little tedious to rewrite them
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
WhyDoThis
WhyDoThis3mo ago
(btw I am loving so far how much closer to actual pg sql kysely allows it to be) less obscurity
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
WhyDoThis
WhyDoThis3mo ago
For sure - I appreciate you and the teams hard work on it!
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
WhyDoThis
WhyDoThis3mo ago
You are too humble haha - sorry to derail the original point of this thread but is there a way to dry run the migration that you know of? My current thought is the only way to test is by wiping the DB completely (or point to a different one) and re-backing it up to compare the schema of the rewritten kysely migration to the original schema created by the knex migration. I've always longed for something like Entity Framework how it can compare and show diffs before executing.
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server