Announcing SQLDelight 2.0

After more than a year of development, we’re finally ready to release SQLDelight 2.0. If you’re a current user of SQLDelight you may be surprised to learn not a whole lot has changed. The package name changed, and the IDE plugin improved dramatically, but other than that SQLDelight works exactly the same as it did pre 2.0. Find the full migration guide here.

We’re generally very happy with how SQLDelight has held up, both as the Android and Kotlin platforms have matured and our codebase using it has grown dramatically. We started SQLDelight because all the fancy ORMs (or ORM-like JVM libraries) of the world bloated our 2014 Android APK that had a hard limit on method counts. SQLDelight’s SQL-first approach was pragmatic at the time, but now we believe it is simply better than anything else out there. And not just for mobile…

So we’re switching our primary focus to server development. Android and multiplatform will still be worked on and improved, but we don’t anticipate changing how SQLDelight fundamentally works on mobile. The biggest thing we’re beginning to experiment with is asynchronous support (try it out on web!) which also serves as an important feature for server development.

The reason for the major release is a complete rework of how dialects work. Each dialect is now their own dependency that SQLDelight’s compiler and IntelliJ plugin download and use dynamically — it’s now possible to build a SQL dialect as a sibling module, extend an existing one, or even publish SQL dialects to open source. There’s third party dialects already with DB2 and CockroachDB, which join the first party MySQL, PostgreSQL, and SQLite dialects. Our goal after this launch will be supporting and enhancing the dialect API to make sure everything that’s needed is available to implement any SQL dialect.

We’ve also fixed how data types and adapters work for the server dialects, added optimistic lock checking, migration file squishing, drivers for R2DBC and web workers, an IDE window for connecting to databases and running queries from your files, and autocomplete and IDE features in migration files. There’s more you can see in the official release notes.

This release more than any other was made possible by the enormous SQLDelight community, and I would like to explicitly thank Alexander Perfilyev for his work on improving the IDE plugin and Philip Wedemann for being the most active maintainer of the library this year in addition to all of the features he wrote as part of this release.

This post is part of Cash App’s Summer of Kotlin Multiplatform series.