SQLDelight v2.0.0-alpha02 Release Notes

Release Date: 2022-04-13 // 2 months ago
  • ๐Ÿ’ฅ Breaking Changes

    • You'll need to replace all occurrences of app.cash.sqldelight.runtime.rx with app.cash.sqldelight.rx2

    โž• Added

    • ๐Ÿ‘ [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
    • ๐Ÿ‘ [PostgreSQL] Support postgres returning statements
    • ๐Ÿ‘ [PostgreSQL] Support postgres date types
    • ๐Ÿ‘ [PostgreSQL] Support pg intervals
    • ๐Ÿ‘ [PostgreSQL] Support PG Booleans and fix inserts on alter tables
    • ๐Ÿ‘ [PostgreSQL] Support optional limits in Postgres
    • ๐Ÿ‘ [PostgreSQL] Support PG BYTEA type
    • โœ… [PostgreSQL] Add a test for postgres serials
    • โšก๏ธ [PostgreSQL] Support for update postgres syntax
    • ๐Ÿ‘ [PostgreSQL] Support PostgreSQL array types
    • [PostgreSQL] Properly store/retrieve UUID types in PG
    • ๐Ÿ‘ [PostgreSQL] Support PostgreSQL NUMERIC type (#1882)
    • ๐Ÿ‘ [PostgreSQL] Support returning queries inside of common table expressions (#2471)
    • ๐Ÿ‘ [PostgreSQL] Support json specific operators
    • [PostgreSQL] Add Postgres Copy (by [Philip Wedemann][hfhbd])
    • ๐Ÿ‘ [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][eygraber])
    • ๐Ÿ‘ [MySQL] Support MySql INTERVAL (#2969 by [Eliezer Graber][eygraber])
    • [HSQL] Add HSQL Window functionality
    • [SQLite] Don't replace equality checks for nullable parameters in a WHERE (#1490 by [Eliezer Graber][eygraber])
    • ๐Ÿ‘ [SQLite] Support Sqlite 3.35 returning statements (#1490 by [Eliezer Graber][eygraber])
    • ๐Ÿ‘ [SQLite] Support GENERATED clause
    • ๐Ÿ‘ [SQLite] Add support for Sqlite 3.38 dialect (by [Eliezer Graber][eygraber])

    ๐Ÿ”„ Changed

    • [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)
    • โšก๏ธ [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][andersio])
    • ๐Ÿ”Œ [Gradle Plugin] Compare schema definitions for migrations (#841)
    • [PostgreSQL] Disallow double quotes for PG
    • [MySQL] Error on usage of == in MySQL (#2673)

    ๐Ÿ›  Fixed

    • [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;
    • [PostgreSQL] Postgresql rename column
    • [MySQL] UNIX_TIMESTAMP, TO_SECONDS, JSON_ARRAYAGG MySQL functions not recognized
    • [SQLite] fix SQLite window functionality
    • ๐Ÿ”Œ [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

Previous changes from v2.0.0-alpha01

  • ๐Ÿš€ This is the first alpha release for 2.0 and has some breaking changes. We expect more ABI breaking changes to come so don't publish any libraries with dependencies on this release (applications should be fine).

    ๐Ÿ’ฅ Breaking Changes

    • First, you'll need to replace all occurrences of com.squareup.sqldelight with app.cash.sqldelight
    • Second, you'll need to replace all occurrences of app.cash.sqldelight.android with app.cash.sqldelight.driver.android
    • Third, you'll need to replace all occurrences of app.cash.sqldelight.sqlite.driver with app.cash.sqldelight.driver.jdbc.sqlite
    • Fourth, you'll need to replace all occurrences of app.cash.sqldelight.drivers.native with app.cash.sqldelight.driver.native
    • โšก๏ธ The IDE plugin must be updated to a 2.X version, which can be found in the alpha or eap channel
    • Dialects are now dependencies which you can specify within gradle:
    sqldelight {
      MyDatabase {
        packageName = "com.example"
        dialect = "app.cash.sqldelight:mysql-dialect:2.0.0-alpha01"
      }
    }
    

    ๐Ÿ‘ The currently supported dialects are mysql-dialect, postgresql-dialect, hsql-dialect, sqlite-3-18-dialect, sqlite-3-24-dialect, sqlite-3-25-dialect, sqlite-3-30-dialect, and sqlite-3-35-dialect

    • ๐Ÿ‘ Primitive types must now be imported (for example INTEGER AS Boolean you have to import kotlin.Boolean), some previously supported types now need an adapter. Primitive adapters are available in app.cash.sqldelight:primitive-adapters:2.0.0-alpha01 for most conversions (like IntColumnAdapter for doing Integer AS kotlin.Int).

    โž• Added

    • ๐Ÿ”Œ [IDE Plugin] Basic suggested migration (by [Alexander Perfilyev][aperfilyev])
    • ๐Ÿ”Œ [IDE Plugin] Add import hint action (by [Alexander Perfilyev][aperfilyev])
    • ๐Ÿ”Œ [IDE Plugin] Add kotlin class completion (by [Alexander Perfilyev][aperfilyev])
    • ๐Ÿ”Œ [Gradle Plugin] Add shortcut for Gradle type safe project accessors (by [Philip Wedemann][hfhbd])
    • [Compiler] Customize codegen based on dialect (by [Marius Volkhart][MariusV])
    • [JDBC Driver] Add common types to JdbcDriver (by [Marius Volkhart][MariusV])
    • ๐Ÿ‘ [SQLite] Add support for the sqlite 3.35 (by [Eliezer Graber][eygraber])
    • ๐Ÿ‘ [SQLite] Add support for ALTER TABLE DROP COLUMN (by [Eliezer Graber][eygraber])
    • ๐Ÿ‘ [SQLite] Add support for Sqlite 3.30 dialect (by [Eliezer Graber][eygraber])
    • ๐Ÿ‘ [SQLite] Support NULLS FIRST/LAST in sqlite (by [Eliezer Graber][eygraber])
    • ๐Ÿ‘ [HSQL] Add HSQL support for generated clause (by [Marius Volkhart][MariusV])
    • ๐Ÿ‘ [HSQL] Add support for named parameters in HSQL (by [Marius Volkhart][MariusV])
    • [HSQL] Customize the HSQL insert query (by [Marius Volkhart][MariusV])

    ๐Ÿ”„ Changed

    • ๐Ÿ“ฆ [Everything] Package name has changed from com.squareup.sqldelight to app.cash.sqldelight.
    • ๐Ÿšš [Runtime] Move dialects into their own isolated gradle modules
    • [Runtime] Switch to driver-implemented query notifications.
    • 0๏ธโƒฃ [Runtime] Extract default column adapters to separate module (#2056, #2060)
    • [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][PaulWoitaschek])
    • ๐Ÿšš [JS Driver] Remove sql.js dependency from sqljs-driver (by [Derek Ellis][dellisd])
    • ๐Ÿšš [Paging] Remove the android paging 2 extension
    • ๐Ÿ”€ [IDE Plugin] Add an editor banner while SQLDelight is syncing (#2511)
    • ๐Ÿ”Œ [IDE Plugin] Minimum supported IntelliJ version is 2021.1

    ๐Ÿ›  Fixed

    • [Runtime] Flatten listener list to reduce allocations and pointer chasing. (by [Anders Ha][andersio])
    • ๐Ÿ”Œ [IDE Plugin] Fix error message to allow jumping to error (by [Philip Wedemann][hfhbd])
    • ๐Ÿ”Œ [IDE Plugin] Add missing inspection descriptions (#2768 by [Alexander Perfilyev][aperfilyev])
    • ๐Ÿ”Œ [IDE Plugin] Fix exception in GotoDeclarationHandler (#2531, #2688, #2804 by [Alexander Perfilyev][aperfilyev])
    • ๐Ÿ”Œ [IDE Plugin] Highlight import keyword (by [Alexander Perfilyev][aperfilyev])
    • ๐Ÿ”Œ [IDE Plugin] Fix unresolved kotlin types (#1678 by [Alexander Perfilyev][aperfilyev])
    • ๐Ÿ“ฆ [IDE Plugin] Fix highlighting for unresolved package (#2543 by [Alexander Perfilyev][aperfilyev])
    • ๐Ÿ”Œ [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][3flex])
    • ๐Ÿ”Œ [IDE Plugin] Use faster annotation API
    • ๐Ÿ”Œ [Gradle Plugin] Explicitly support js/android plugins when adding runtime (by [Zac Sweers][ZacSweers])
    • ๐Ÿ”Œ [Gradle Plugin] Register migration output task without derviving schemas from migrations (#2744 by [Kevin Cianfarini][kevincianfarini])
    • ๐Ÿ”Œ [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][ZacSweers])
    • [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][aperfilyev])
    • ๐Ÿ“ฆ [Compiler] Fix packageName for migration adapter (by [Philip Wedemann][hfhbd])
    • [Compiler] Emit annotations on properties instead of types (#2798 by [Alexander Perfilyev][aperfilyev])
    • [Compiler] Sort arguments before passing to a Query subtype (#2379 by [Alexander Perfilyev][aperfilyev])