kysely-org / kysely

A type-safe typescript SQL query builder
https://kysely.dev
MIT License
10.22k stars 260 forks source link

feature request: non-transactional migrations for concurrent index creation #352

Open tgriesser opened 1 year ago

tgriesser commented 1 year ago

👋 First just wanted to say this project looks awesome! Pretty close to what I wish Knex was if I started it now, with the affordances of modern TypeScript instead of 10 years ago when we were stuck in ES5 and Promises weren't even really an official language construct yet.

I started to play around with it a bit and couldn't find a way to do non-transactional migrations, though there's a chance I was missing something. This is necessary when running statements like CREATE INDEX CONCURRENTLY which cannot be run inside a transaction in PostgreSQL.

Knex does this with a config property that can be set in a migration file:

https://knexjs.org/guide/migrations.html#transactions-in-migrations

export const config = { transaction: false }

Wanted to see if this was something on the radar or if you'd be open to a similar API for configuring per-file migrations, or another approach that'd offer similar support.

koskimas commented 1 year ago

Hi, and thank you!

I've used knex for a long time and both of my OSS projects owe a lot of their success to knex.

with the affordances of modern TypeScript instead of 10 years ago when we were stuck in ES5 and Promises weren't even really an official language construct yet.

Yeah, objection suffers from the same problem. It was also designed before typescript and good typescript support would mean almost a full rewrite.

About the issue itself: seems like a good (and necessary) addition.