Skip to content

Releases: kysely-org/kysely

0.24.2

30 Mar 09:45
Compare
Choose a tag to compare
  • Add mysql helper module with jsonArrayFrom and jsonObjectFrom functions. See this recipe for more info.

0.24.0

30 Mar 04:50
Compare
Choose a tag to compare

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 for DeleteQueryBuilder. Thank you @anirudh1713 ❤️ #314
  • Fix #398. Thank you @igalklebanov ❤️ #399
  • Allow streaming of update, insert and delete 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

06 Mar 09:40
Compare
Choose a tag to compare
  • Force IDEs to show simple result types on hover

Screenshot 2023-03-06 at 11 39 06

Thank you @steida for pointing me to the Simplify helper.

0.23.4

15 Jan 09:14
Compare
Choose a tag to compare

0.23.3

29 Dec 14:53
Compare
Choose a tag to compare
  • Fix regression bug where comparing non-nullable and nullable values weren't allowed by the types in where, having and other comparison methods.

0.23.2

29 Dec 09:15
Compare
Choose a tag to compare
  • Add the assertType method for dealing with Type instantiation is excessively deep and possibly infinite errors.
  • Add clearSelect, clearWhere etc. methods. Thank you @wirekang ❤️

0.23.1

27 Dec 09:45
Compare
Choose a tag to compare

0.23.0

26 Dec 10:20
Compare
Choose a tag to compare

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 with CamelCasePlugin #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 the RawBuilder 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

01 Oct 12:43
Compare
Choose a tag to compare

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)')

0.21.6

03 Sep 13:31
Compare
Choose a tag to compare
  • Start using default instead of null for missing values in multi-row inserts on supported dialects.