Releases: kysely-org/kysely
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)')