github cashapp/sqldelight 2.0.0
Version 2.0.0 (2023-07-26)

latest releases: 2.0.2, 2.0.1
9 months ago

SQLDelight 2.0

Please see the detailed upgrading information for how to upgrade from SQLDelight 1.x to SQLDelight 2.0. The IntelliJ plugin needs to go through an approval before it lands on the marketplace inside of IntelliJ but can be downloaded and installed from disk below.

The below notes are all changes from SQLDelight 1.5.5. For only the changes from SQLDelight 2.0.0-rc02 please see the Changelog. Some highlights which signify major changes are highlighted.

All Environments

Added

  • [Runtime] Add fun modifier to Listener interface.
  • [Runtime] Add linuxArm64, androidNative and watchosDeviceArm targets to runtime (#4258 by Philip Wedemann)
  • [Runtime] Add support for async drivers (#3168 by Derek Ellis)
  • [IDE Plugin] Added support for running SQLite, MySQL, and PostgreSQL commands against a running database (#2718 by Alexander Perfilyev)
  • [IDE Plugin] Add support for the android studio DB inspector (#3107 by Alexander Perfilyev)
  • [IDE Plugin] Add sqldelight directory suggestions (#3976 by Alexander Perfilyev)
  • [IDE Plugin] Compact middle packages in project tree (#3992 by Alexander Perfilyev)
  • [IDE Plugin] Add join clause completion (#4086 by Alexander Perfilyev)
  • [IDE Plugin] Create view intention and live template (#4074 by Alexander Perfilyev)
  • [IDE Plugin] Warn about missing WHERE inside DELETE or UPDATE (#4058 by Alexander Perfilyev)
  • [IDE Plugin] Basic suggested migration (by Alexander Perfilyev)
  • [IDE Plugin] Add import hint action (by Alexander Perfilyev)
  • [IDE Plugin] Add kotlin class completion (by Alexander Perfilyev)
  • [Compiler] Support returning at the end of a grouped statement
  • [Compiler] Support compiler extensions via dialect modules and add a SQLite JSON extension (#1379, #2087)
  • [Compiler] Support PRAGMA statements which return a value (#1106)
  • [Compiler] Support generating value types for marked columns
  • [Compiler] Add support for optimistic locks and validation (#1952)
  • [Compiler] Support multi-update statements
  • [Compiler] Customize codegen based on dialect (by Marius Volkhart)
  • [Gradle Plugin] Add better version catalog support for dialects (#3435)
  • [Gradle Plugin] Expose the classpath for SQLDelight tasks
  • [Gradle Plugin] Add a gradle task for squashing migrations
  • [Gradle Plugin] Add a flag to ignore schema definitions during migration checks

Changed

  • [Everything] Package name has changed from com.squareup.sqldelight to app.cash.sqldelight.
  • [Runtime] Move migration callbacks into main migrate fun
  • [Runtime] Improve addListener api (#4244 by Philip Wedemann)
  • [Runtime] Use Long as migration version (#4297 by Philip Wedemann)
  • [Runtime] Enforce that synchronous drivers require a synchronous schema initializer (#4013)
  • [Runtime] Improve async support for Cursors (#4102)
  • [Runtime] Remove deprecated targets (#4149 by Philip Wedemann)
  • [Runtime] Remove support for old MM (#4148 by Philip Wedemann)
  • [Runtime] Remove the AfterVersion type without the driver (#3091)
  • [Runtime] Move Schema type to top-level
  • [Runtime] Open dialect and resolver to support 3rd party implementations (#3232 by Philip Wedemann)
  • [Runtime] Return the updated row count from the drivers execute method
  • [Runtime] Confine SqlCursor to the critical section accessing the connection. (#2123 by Anders Ha)
  • [Runtime] Move dialects into their own isolated gradle modules
  • [Runtime] Switch to driver-implemented query notifications.
  • [Runtime] Extract default column adapters to separate module (#2056, #2060)
  • [Async Runtime] Move await* to upper class ExecutableQuery (#3524 by Philip Wedemann)
  • [Compiler] Include the dialect used to compile in failure reports (#3086)
  • [Compiler] Skip unused adapters (#3162 by Eliezer Graber)
  • [Compiler] Use zero based index in PrepareStatement (#3269 by Philip Wedemann)
  • [Compiler] Clean up generated code a bit
  • [Compiler] Forbid usage of table parameters in grouped statements (#1822)
  • [Compiler] Put grouped queries inside a transaction (#2785)
  • [Compiler] Let modules generate the queries implementations instead of redoing it in each module
  • [Compiler] Remove the custom toString generation of generated data classes. (by Paul Woitaschek)
  • [IDE Plugin] Add an editor banner while SQLDelight is syncing (#2511)
  • [IDE Plugin] Minimum supported IntelliJ version is 2021.1
  • [Gradle Plugin] Allow registering DriverInitializer for VerifyMigrationTask with ServiceLoader mechanism (#3986 by Alex Doubov)
  • [Gradle Plugin] Create explicit compiler env (#4079 by Philip Wedemann)
  • [Gradle Plugin] Hide Configurations from downstream projects
  • [Gradle Plugin] Only shade Intellij (by Philip Wedemann)
  • [Gradle Plugin] Also make the dialect a proper gradle dependency instead of a string (#3085)
  • [Gradle Plugin] Gradle Verify Task: Throw when missing database file. (#3126 by Niklas Baudy)
  • [Gradle Plugin] Compare schema definitions for migrations (#841)

Fixed

  • [Runtime] Flatten listener list to reduce allocations and pointer chasing. (by Anders Ha)
  • [Compiler] Fix result expression for grouped statements (#4378)
  • [Compiler] Include PRAGMAs from migrations in database create(SqlDriver) (#3845 by Marius Volkhart)
  • [Compiler] Fix codegen for RETURNING clause (#3872 by Marius Volkhart)
  • [Compiler] Dont generate types for virtual tables (#4015)
  • [Compiler] Resolve recursive origin table from pure views (by Philip Wedemann)
  • [Compiler] Use value classes from table foreign key clause (by Philip Wedemann)
  • [Compiler] Fix SelectQueryGenerator to support bind expression without parenthesis (by Doogie Min)
  • [Compiler] Fix duplicate generation of ${name}Indexes variables when using transactions (by Andreas Sacher)
  • [Compiler] Custom dialect with extension function don't create imports (#3338 by Philip Wedemann)
  • [Compiler] Fix escaping CodeBlock.of("${CodeBlock.toString()}") (#3340 by Philip Wedemann)
  • [Compiler] Await async execute statements in migrations (#3352)
  • [Compiler] Fix AS (#3370 by Philip Wedemann)
  • [Compiler] getObject method supports automatic filling of the actual type. (#3401 by Rob X)
  • [Compiler] Fix codegen for async grouped returning statements (#3411)
  • [Compiler] Infer the Kotlin type of bind parameter, if possible, or fail with a better error message (#3413 by Philip Wedemann)
  • [Compiler] Don't allow ABS("foo") (#3430 by Philip Wedemann)
  • [Compiler] Support inferring kotlin type from other parameters (#3431 by Philip Wedemann)
  • [Compiler] Always create the database implementation (#3540 by Philip Wedemann)
  • [Compiler] Relax javaDoc and add it to custom mapper function too (#3554 Philip Wedemann)
  • [Compiler] Fix DEFAULT in binding (by Philip Wedemann)
  • [Compiler] Ensure updates and deletes with RETURNING statements execute queries. (#3084)
  • [Compiler] Correctly infer argument types in compound selects (#3096)
  • [Compiler] Common tables do not generate data classes so dont return them (#3097)
  • [Compiler] Find the top migration file faster (#3108)
  • [Compiler] Properly inherit nullability on the pipe operator
  • [Compiler] Support the iif ANSI SQL function
  • [Compiler] Don't generate empty query files (#3300 by Philip Wedemann)
  • [Compiler] Fix adapter with question mark only (#3314 by Philip Wedemann)
  • [Compiler] Same adapter type from different tables causing a compilation error in 2.0 alpha
  • [Compiler] Problem compiling upsert statement (#2791)
  • [Compiler] Query result should use tables in the select if there are multiple matches (#1874, #2313)
  • [Compiler] Support updating a view which has a INSTEAD OF trigger (#1018)
  • [Compiler] Support from and for in function names
  • [Compiler] Allow SEPARATOR keyword in function expressions
  • [Compiler] Cannot access ROWID of aliased table in ORDER BY
  • [Compiler] Aliased column name is not recognized in HAVING clause in MySQL
  • [Compiler] Erroneous 'Multiple columns found' error
  • [Compiler] Unable to set PRAGMA locking_mode = EXCLUSIVE;
  • [Compiler] Use faster APIs for iterating files and dont explore the entire PSI graph
  • [Compiler] Add keyword mangling to select function parameters (#2759 by Alexander Perfilyev)
  • [Compiler] Fix packageName for migration adapter (by Philip Wedemann)
  • [Compiler] Emit annotations on properties instead of types (#2798 by Alexander Perfilyev)
  • [Compiler] Sort arguments before passing to a Query subtype (#2379 by Alexander Perfilyev)
  • [IDE Plugin] Handle process cancellation during find usages (#4340)
  • [IDE Plugin] Fix unresolved kotlin types (#3924 by Alexander Perfilyev)
  • [IDE Plugin] Fix for expand wildcard intention to work with qualifier (#3979 by Alexander Perfilyev)
  • [IDE Plugin] Use available jdk if java home is missing (#3925 by Alexander Perfilyev)
  • [IDE Plugin] Fix find usages on package names (#4010)
  • [IDE Plugin] Dont show auto imports for invalid elements (#4008)
  • [IDE Plugin] Do not resolve if a dialect is missing (#4009)
  • [IDE Plugin] Ignore IDE runs of the compiler during an invalidated state (#4016)
  • [IDE Plugin] Add support for IntelliJ 2023.1 (#4037 by Madis Pink)
  • [IDE Plugin] Rename named argument usage on column rename (#4027 by Alexander Perfilyev)
  • [IDE Plugin] Fix add migration popup (#4105 by Alexander Perfilyev)
  • [IDE Plugin] Disable SchemaNeedsMigrationInspection in migration files (#4106 by Alexander Perfilyev)
  • [IDE Plugin] Use sql column name for migration generation instead of type name (#4112 by Alexander Perfilyev)
  • [IDE Plugin] Fix NoSuchFieldError in newer Kotlin plugins (#3422 by Madis Pink)
  • [IDE Plugin] IDEA: UnusedQueryInspection - fix ArrayIndexOutOfBoundsException. (#3427 by Niklas Baudy)
  • [IDE Plugin] Use reflection for old kotlin plugin references
  • [IDE Plugin] Use java home for gradle tooling API (#3078)
  • [IDE Plugin] Load the JDBC driver on the correct classLoader inside the IDE plugin (#3080)
  • [IDE Plugin] Mark the file element as null before invalidating to avoid errors during already existing PSI changes (#3082)
  • [IDE Plugin] Dont crash finding usages of the new table name in an ALTER TABLE statement (#3106)
  • [IDE Plugin] Optimize the inspectors and enable them to fail silently for expected exception types (#3121)
  • [IDE Plugin] Delete files that should be generated directories (#3198)
  • [IDE Plugin] Fix a not-safe operator call
  • [IDE Plugin] Run the goto handler in an empty progress indicator (#2990)
  • [IDE Plugin] Ensure the highlight visitor doesnt run if the project isnt configured (#2981, #2976)
  • [IDE Plugin] Ensure transitive generated code is also updated in the IDE (#1837)
  • [IDE Plugin] Invalidate indexes when updating the dialect
  • [IDE Plugin] Fix error message to allow jumping to error (by Philip Wedemann)
  • [IDE Plugin] Add missing inspection descriptions (#2768 by Alexander Perfilyev)
  • [IDE Plugin] Fix exception in GotoDeclarationHandler (#2531, #2688, #2804 by Alexander Perfilyev)
  • [IDE Plugin] Highlight import keyword (by Alexander Perfilyev)
  • [IDE Plugin] Fix unresolved kotlin types (#1678 by Alexander Perfilyev)
  • [IDE Plugin] Fix highlighting for unresolved package (#2543 by Alexander Perfilyev)
  • [IDE Plugin] Dont attempt to inspect mismatched columns if the project index is not yet initialized
  • [IDE Plugin] Dont initialize the file index until a gradle sync has occurred
  • [IDE Plugin] Cancel the SQLDelight import if a gradle sync begins
  • [IDE Plugin] Regenerate the database outside of the thread an undo action is performed on
  • [IDE Plugin] If a reference cannot be resolves use a blank java type
  • [IDE Plugin] Correctly move off the main thread during file parsing and only move back on to write
  • [IDE Plugin] Improve compatibility with older IntelliJ versions (by Matthew Haughton)
  • [IDE Plugin] Use faster annotation API
  • [Gradle Plugin] Use stable output path for generated source (#4269 by Josh Friend)
  • [Gradle Plugin] Small Gradle plugin QoL improvements (#3930 by Zac Sweers)
  • [Gradle Plugin] Convert tasks to use lazy configuration API (by Matthew Haughton)
  • [Gradle Plugin] Avoid NPEs in Kotlin 1.7.20 (#3398 by Zac Sweers)
  • [Gradle Plugin] Fix description of squash migrations task (#3449)
  • [Gradle Plugin] Minor cleanups and tweaks to the Gradle plugin (#3171 by Matthew Haughton)
  • [Gradle Plugin] Dont use an AGP string for the generated directory
  • [Gradle Plugin] Use AGP namespace attribute (#3220)
  • [Gradle Plugin] Do not add kotlin-stdlib as a runtime dependency of the Gradle plugin (#3245 by [Martin Bonnin][mbonnin])
  • [Gradle Plugin] Simplify the multiplatform configuration (#3246 by [Martin Bonnin][mbonnin])
  • [Gradle Plugin] Support js only projects (#3310 by Philip Wedemann)
  • [Gradle Plugin] Add shortcut for Gradle type safe project accessors (by Philip Wedemann)
  • [Gradle Plugin] Explicitly support js/android plugins when adding runtime (by Zac Sweers)
  • [Gradle Plugin] Register migration output task without derviving schemas from migrations (#2744 by Kevin Cianfarini)
  • [Gradle Plugin] If the migration task crashes, print the file it crashed running
  • [Gradle Plugin] Sort files when generating code to ensure idempotent outputs (by Zac Sweers)

SQLite

Added

  • [JSON Extensions] Support JSON table functions (#3090)
  • [SQLite Dialect] Add SQLite 3.33 support (UPDATE FROM) (by Eliezer Graber))
  • [SQLite Dialect] Don't replace equality checks for nullable parameters in a WHERE (#1490 by Eliezer Graber)
  • [SQLite Dialect] Support Sqlite 3.35 returning statements (#1490 by Eliezer Graber)
  • [SQLite Dialect] Support GENERATED clause
  • [SQLite Dialect] Add support for Sqlite 3.38 dialect (by Eliezer Graber)
  • [SQLite Dialect] Add support for the sqlite 3.35 (by Eliezer Graber)
  • [SQLite Dialect] Add support for ALTER TABLE DROP COLUMN (by Eliezer Graber)
  • [SQLite Dialect] Add support for Sqlite 3.30 dialect (by Eliezer Graber)
  • [SQLite Dialect] Support NULLS FIRST/LAST in sqlite (by Eliezer Graber)
  • [Native Driver] Add callback to hook into DatabaseConfiguration creation of NativeSqliteDriver (#3512 by Sven Jacobs)
  • [Native Driver] Support new kotlin native memory model (#3177 by Kevin Galligan)

Changed

  • [Sqlite Driver] Simplify using schema migrations for JdbcSqliteDriver (#3737 by [Lukáš Moravec][])
  • [Gradle Plugin] Add automatic dialect support for Android API 34 (#4251)

Fixed

  • [SQLite 3.35 Dialect] Only show an error when dropping an indexed column from the altered table (#3158 by Eliezer Graber)
  • [SQLite] fix SQLite window functionality

MySQL

Added

  • [MySQL Dialect] MySQL: support timestamp/bigint in IF expression (#4329 by Mike Gershunovsky)
  • [MySQL Dialect] support lowercase date types and min and max on date types (#4243 by Mike Gershunovsky)
  • [MySQL Dialect] support mysql types for binary expr and sum (#4254 by Mike Gershunovsky)
  • [MySQL Dialect] support unsigned ints without display width (#4306 by Mike Gershunovsky)
  • [MySQL Dialect] Support LOCK IN SHARED MODE
  • [MySQL Dialect] Add sql char length functions (#4134 by Griffio)
  • [MySQL Dialect] Support FOR SHARE and FOR UPDATE in MySQL (#3098)
  • [MySQL Dialect] Support MySQL index hints (#3099)
  • [MySQL] Support MySQL Replace
  • [MySQL] Support NUMERIC/BigDecimal MySQL types (#2051)
  • [MySQL] Support MySQL truncate statement
  • [MySQL] Support json specific operators in Mysql (by Eliezer Graber)
  • [MySQL] Support MySql INTERVAL (#2969 by Eliezer Graber)

Changed

  • [MySQL] Error on usage of == in MySQL (#2673)

Fixed

  • [MySQL] UNIX_TIMESTAMP, TO_SECONDS, JSON_ARRAYAGG MySQL functions not recognized

PostgreSQL

Added

  • [PostgreSQL Dialect] Add boolean and Timestamp to min max (#4245 by Griffio)
  • [PostgreSQL Dialect] Postgres: Add window function support (#4283 by Philip Wedemann)
  • [PostgreSQL Dialect] add support and test for gen_random_uuid() (#3855 by David Wheeler)
  • [PostgreSQL Dialect] Alter table add constraint postgres (#4116 by Griffio)
  • [PostgreSQL Dialect] Alter table add constraint check (#4120 by Griffio)
  • [PostgreSQL Dialect] Add postgreSql character length functions (#4121 by Griffio)
  • [PostgreSQL Dialect] Add postgreSql column default interval (#4142 by Griffio)
  • [PostgreSQL Dialect] Add postgreSql interval column result (#4152 by Griffio)
  • [PostgreSQL Dialect] Add postgreSql Alter Column (#4165 by Griffio)
  • [PostgreSQL Dialect] PostgreSQL: Add date_part (#4198 by Philip Wedemann)
  • [PostgreSQL Dialect] Support UPDATE FROM in postgresql (by Eliezer Graber))
  • [PostgreSQL Dialect] PostgreSQL: Support using DEFAULT for generated columns in INSERT (#3373 by Philip Wedemann)
  • [PostgreSQL Dialect] Add NOW() to PostgreSQL (#3403 by Philip Wedemann)
  • [PostgreSQL Dialect] PostgreSQL Add NOT operator (#3504 by Philip Wedemann)
  • [PostgreSQL Dialect] Add date_trunc (#3295 by Philip Wedemann)
  • [PostgreSQL Dialect] Support postgres returning statements
  • [PostgreSQL Dialect] Support postgres date types
  • [PostgreSQL Dialect] Support pg intervals
  • [PostgreSQL Dialect] Support PG Booleans and fix inserts on alter tables
  • [PostgreSQL Dialect] Support optional limits in Postgres
  • [PostgreSQL Dialect] Support PG BYTEA type
  • [PostgreSQL Dialect] Add a test for postgres serials
  • [PostgreSQL Dialect] Support for update postgres syntax
  • [PostgreSQL Dialect] Support PostgreSQL array types
  • [PostgreSQL Dialect] Properly store/retrieve UUID types in PG
  • [PostgreSQL Dialect] Support PostgreSQL NUMERIC type (#1882)
  • [PostgreSQL Dialect] Support returning queries inside of common table expressions (#2471)
  • [PostgreSQL Dialect] Support json specific operators
  • [PostgreSQL Dialect] Add Postgres Copy (by Philip Wedemann)

Changed

  • [PostgreSQL Dialect] Disallow double quotes for PG

Fixed

  • [PostgreSQL Dialect] Postgres: Fix Array without type parameter (by Philip Wedemann)
  • [PostgreSQL Dialect] Postgres primary key columns are always non-null (#3092)
  • [PostgreSQL Dialect] Fix copy with same name in multiple tables (#3297 by Philip Wedemann)
  • [PostgreSQL Dialect] Postgresql rename column

HSQL

Added

  • [HSQL Dialect] Hsql: Support using DEFAULT for generated columns in Insert (#3372 by Philip Wedemann)
  • [HSQL Dialect] Add HSQL Window functionality
  • [HSQL Dialect] Add HSQL support for generated clause (by Marius Volkhart)
  • [HSQL Dialect] Add support for named parameters in HSQL (by Marius Volkhart)
  • [HSQL Dialect] Customize the HSQL insert query (by Marius Volkhart)

Fixed

Web

Added

  • [JS Driver] Add a driver for SqlJs workers (#3203 by Derek Ellis)
  • [Web Driver] Enable NPM package publishing (#4364)

Changed

  • [JS Driver] Split web worker driver into separate artifact
  • [JS Driver] Don't expose JsWorkerSqlCursor (#3874 by Philip Wedemann)
  • [JS Driver] Disable publication of the sqljs driver (#4108)
  • [JS Driver] Remove sql.js dependency from sqljs-driver (by Derek Ellis)

R2DBC Driver

Changed

Fixed

Paging Extension

Added

  • [Paging] Multiplatform paging extension (by Jeff Lockhart)
  • [Paging] Add linux and mingw x64 target to the paging extension (#4280 by Cedric Hippmann)
  • [Paging] Add iosSimulatorArm64 target to androidx-paging3 extension (#4117)
  • [Paging] Add js browser target to paging extensions (#3843 by Sean Proctor)
  • [Paging] Allow passing in CoroutineContext to *QueryPagingSource (#3384)

Changed

  • [Paging] Remove the android paging 2 extension
  • [Paging] Add support for SuspendingTransacter in QueryPagingSource (#4292 by Ilya Polenov)
  • [Paging] Add a default dispatcher to the KeyedQueryPagingSource backed QueryPagingSource function (#3385)
  • [Paging] Make OffsetQueryPagingSource only work with Int (#3386)

Fixed

  • [Paging] Fix Paging 3 (#3396)
  • [Paging] Allow construction of OffsetQueryPagingSource with Long (#3409)
  • [Paging] Don't statically swap Dispatchers.Main (#3428)

Coroutines Extension

Changed

  • [Coroutines Extensions] Remove default params to flow extensions (#3489)

Don't miss a new sqldelight release

NewReleases is sending notifications on new releases.