Releases: kysely-org/kysely
0.24.2
- Add mysql helper module with
jsonArrayFrom
andjsonObjectFrom
functions. See this recipe for more info.
0.24.0
So much new stuff and big improvements, I don't know where to start! 🎉. There should be no breaking changes, but with this amount of changes and new features, it's always possible we've broken something 😬. As always, please open an issue if something is broken.
Let's start with the reason some of you are here: the deprecated filter methods and the improved ExpressionBuilder
:
The improved ExpressionBuilder
We've deprecated most of the where
, having
, on
and other filter methods like whereExists
, whereNotExists
, orWhere
, orWhereExists
in favour of the new expression builder. To get an idea what the expression builder is and what it can do, you should take a look at this recipe. Here are some of the most common migrations you should do:
// Old
where(eb => eb
.where('first_name', '=', 'Jennifer')
.orWhere('last_name', '=', 'Aniston')
)
// New
where(({ or, cmpr }) => or([
cmpr('first_name', '=', 'Jennifer'),
cmpr('last_name', '=', 'Aniston')
]))
// Old
whereNotExists(eb => eb
.selectFrom('pet')
.select('pet.id')
.whereRef('pet.owner_id', '=', 'person.id')
)
// New
where(({ not, exists, selectFrom }) => not(exists(
selectFrom('pet')
.select('pet.id')
.whereRef('pet.owner_id', '=', 'person.id')
)))
You can fine more examples here and here.
The new website 🎉
The first version of kysely.dev is out 🎉 A huge thanks to @fhur for the initiative and for doing allmost all work on that ❤️
Now that the site is out, we'll concentrate on adding more documentation and examples there. For now, it's pretty minimal.
Other changes
- Add compiled query and timings to error logs. Thank you @fwojciec ❤️ #355
- Add
returningAll('table')
overload forDeleteQueryBuilder
. Thank you @anirudh1713 ❤️ #314 - Fix #398. Thank you @igalklebanov ❤️ #399
- Allow streaming of
update
,insert
anddelete
query results on postgres. Thank you @igalklebanov ❤️ #377 - Add
where
method toCreateIndexBuilder
. Thank you @igalklebanov ❤️ #371 - Added a new module
kysely/helpers/postgres
for some postgres-spcific higher level helpers. Similar packages will be added for other dialects too in the future. See this recipe for the newly available helpers. - Simplified types (performance-wise). Small gains here and there.
0.23.5
0.23.4
- Add
ifNotExists
forCreateIndexBuilder
#253 - Add
using
clause support forDeleteQueryBuilder
#241. Thank you @igalklebanov ❤️ - Add
match
to the list of supported comparison operators #280. Thank you @jonluca ❤️ - Pass options to dialect adapter migration lock methods (not a breaking change).
0.23.3
0.23.2
0.23.1
0.23.0
So many fixes and features in this one. @igalklebanov has been on fire 🔥. Almost all of these are his awesome work.
- Fix bug that prevented
ArrayBuffer
usage withCamelCasePlugin
#193. Thank you @igalklebanov ❤️ - Add
fn.coalesce
helper #179. Thank you @igalklebanov ❤️ - Refactor internals to use the new Expression interface
- Allow aggregate functions to return a nullable value #183. Thank you @igalklebanov ❤️
- Fix bug with multiple default values in inserts #202. Thank you @igalklebanov ❤️
- Support the
exactOptionalPropertyTypes
typescript setting #210. Thank you @igalklebanov ❤️ - Fix migrationKey calculation keeping dot when .mjs #220. Thank you @igalklebanov ❤️
- Allow subqueries and raw
sql
in distinctOn #239. Thank you @naorpeled ❤️ - Support multiple column operation in
alter table
query #238. Thank you @naorpeled ❤️ - Add numInsertedOrUpdatedRows to InsertResult #188. Thank you @igalklebanov ❤️
- Fix #235. Thank you @tobiasfoerg ❤️
- Add
call
method to create/alter table statement builders #242. Thank you @jacobpgn ❤️ - Add filter clause support at AggregateFunctionBuilder #208. Thank you @igalklebanov ❤️
Breaking changes
- The types are now more strict in some places. If you are using raw
sql
expressions or theRawBuilder
class, you may need to specify a type for the expression like this:
sql<string>`something`
- Following the changes in #238, you can alter multiple columns, and the alterations have moved to a callback:
Before:
await db.schema
.alterTable('person')
.alterColumn('first_name')
.setDataType('text')
.execute();
After:
await db.schema
.alterTable('person')
.alterColumn('first_name', (ac) => ac.setDataType('text'))
.execute()
0.22.0
- Add better aggregate function builder. Thank you @igalklebanov ❤️
- Add support for intersect and except set operations. Thank you @igalklebanov ❤️
Breaking changes
CreateIndexBuilder
used to invalidly add two sets of parentheses in some cases. For example, before you could write a query like this:
db.schema
.createIndex('idx')
.on('table')
.expression('a < 10')
and it worked because Kysely added the needed double parentheses for that particular case. The problem is that not all expressions should have double parentheses and the expression
method shouldn't add the second set.
If you've used db.schema.createIndex
with a custom expression
you may need to add the extra set of parentheses depending on the query (check the database docs). For example in case of our example, you'll need to change it into:
db.schema
.createIndex('idx')
.on('table')
.expression('(a < 10)')