-
Notifications
You must be signed in to change notification settings - Fork 516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide SqlDriver as a parameter to AfterVersion #2618
Conversation
In order to run an update, a SqlDriver is required in order to actually run update queries within an AfterVersion. Due to the fact that the callback is provided as a parameter to the AndroidSqliteDriver constructor, this makes it difficult to get the database to do updates without wrapping the existing AndroidSqliteDriver.Callback or a SupportSQLiteOpenHelper.Callback instead. This patch adds the SqlDriver as a parameter to the AfterVersion lambda to make this easier. Fixes #2534 and fixes #2614.
...on-migration-callbacks/src/test/java/com/squareup/sqldelight/integration/IntegrationTests.kt
Outdated
Show resolved
Hide resolved
This is a binary-incompatible change and thus cannot be accepted. |
Fair point - updating with a version that should be binary compatible - am open to redo-ing this with another method / approach if there's another approach that the maintainers prefer to go with. |
open class Callback( | ||
private val schema: SqlDriver.Schema, | ||
vararg callbacks: AfterVersion, | ||
vararg callbacks: AfterVersionWithParameter, | ||
) : SupportSQLiteOpenHelper.Callback(schema.version) { | ||
private val callbacks = callbacks | ||
|
||
constructor( | ||
schema: SqlDriver.Schema | ||
) : this(schema, *emptyArray()) | ||
) : this(schema, *emptyArray<AfterVersionWithParameter>()) | ||
|
||
constructor( | ||
schema: SqlDriver.Schema, | ||
vararg callbacks: AfterVersion | ||
) : this(schema, *callbacks.map { it.toAfterVersionWithParameter() }.toTypedArray() ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be backward compatible safely - the kotlinx binary-compatibility-validator says that this is just the addition of another constructor (despite changing the "primary" constructor, since there isn't a primary constructor in Java).
* has finished migrating to [afterVersion]. Unlike [AfterVersion], this version's lambda accepts a | ||
* [SqlDriver] as a parameter to make migrations easier. | ||
*/ | ||
class AfterVersionWithParameter( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one thing i thought about was maybe we could make this a BeforeVersion
instead, but then it would be confusing (why use BeforeVersion
instead of AfterVersion
and why aren't they the same). Not happy with the name either, but naming is hard.
fun AfterVersion.toAfterVersionWithParameter() = | ||
AfterVersionWithParameter(afterVersion) { block() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the access to afterVersion
and block
are internal
in AfterVersion
, so wanted to have this so AndroidSqliteDriver
could also wrap.
looks good to me, I think I'd change the name to |
diff --git a/drivers/android-driver/src/main/java/com/squareup/sqldelight/android/AndroidSqliteDriver.kt b/drivers/android-driver/src/main/java/com/squareup/sqldelight/android/AndroidSqliteDriver.kt
--- drivers/android-driver/src/main/java/com/squareup/sqldelight/android/AndroidSqliteDriver.kt
+++ drivers/android-driver/src/main/java/com/squareup/sqldelight/android/AndroidSqliteDriver.kt
@@ -10,9 +10,9 @@
import androidx.sqlite.db.SupportSQLiteStatement
import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory
import com.squareup.sqldelight.Transacter
import com.squareup.sqldelight.db.AfterVersion
-import com.squareup.sqldelight.db.AfterVersionWithParameter
+import com.squareup.sqldelight.db.AfterVersionWithDriver
import com.squareup.sqldelight.db.SqlCursor
import com.squareup.sqldelight.db.SqlDriver
import com.squareup.sqldelight.db.SqlDriver.Schema
import com.squareup.sqldelight.db.SqlPreparedStatement
@@ -155,20 +155,20 @@
}
open class Callback(
private val schema: SqlDriver.Schema,
- vararg callbacks: AfterVersionWithParameter,
+ vararg callbacks: AfterVersionWithDriver,
) : SupportSQLiteOpenHelper.Callback(schema.version) {
private val callbacks = callbacks
constructor(
schema: SqlDriver.Schema
- ) : this(schema, *emptyArray<AfterVersionWithParameter>())
+ ) : this(schema, *emptyArray<AfterVersionWithDriver>())
constructor(
schema: SqlDriver.Schema,
vararg callbacks: AfterVersion
- ) : this(schema, *callbacks.map { it.toAfterVersionWithParameter() }.toTypedArray() )
+ ) : this(schema, *callbacks.map { it.toAfterVersionWithDriver() }.toTypedArray() )
override fun onCreate(db: SupportSQLiteDatabase) {
schema.create(AndroidSqliteDriver(openHelper = null, database = db, cacheSize = 1))
}
diff --git a/docs/common/migrations.md b/docs/common/migrations.md
--- docs/common/migrations.md
+++ docs/common/migrations.md
@@ -33,16 +33,16 @@
AfterVersion(3) { database.execute(null, "INSERT INTO test (value) VALUES('hello')", 0) },
) -Alternatively, it is often useful to receive the Database.Schema.migrateWithCallbacks(
driver = database,
oldVersion = 0,
newVersion = Database.Schema.version,
- AfterVersionWithParameter(3) { it.execute(null, "INSERT INTO test (value) VALUES('hello')", 0) },
+ AfterVersionWithDriver(3) { it.execute(null, "INSERT INTO test (value) VALUES('hello')", 0) },
) In the following example, if you have 1.sqm, 2.sqm, 3.sqm, 4.sqm, and 5.sqm as migrations, the above callback will happen after 3.sqm completes when the database is on version 4. After the callback it will resume at 4.sqm and complete the remaining migrations, in this case 4.sqm and 5.sqm, meaning the final database version is 6.
/**
/**
/**
import com.google.common.truth.Truth.assertThat
|
LOL |
trying to commit from vscode web did not work |
are you able to make the change quickly to AfterVersionWithDriver |
sure, on it |
drivers/android-driver/src/main/java/com/squareup/sqldelight/android/AndroidSqliteDriver.kt
Outdated
Show resolved
Hide resolved
should be ready now. |
just need to run |
ran it |
Thanks just missed it by a few seconds 😂 |
* Provide SqlDriver as a parameter to AfterVersion In order to run an update, a SqlDriver is required in order to actually run update queries within an AfterVersion. Due to the fact that the callback is provided as a parameter to the AndroidSqliteDriver constructor, this makes it difficult to get the database to do updates without wrapping the existing AndroidSqliteDriver.Callback or a SupportSQLiteOpenHelper.Callback instead. This patch adds the SqlDriver as a parameter to the AfterVersion lambda to make this easier. Fixes #2534 and fixes #2614. * Use it to avoid shadowing database * Make change binary compatible * Revert file accidentally changed * Add a comment * Rename to AfterVersionWithDriver * Rename extension function * Comment typos * Run spotless Co-authored-by: Alec Strong <astrong@squareup.com>
* Provide SqlDriver as a parameter to AfterVersion In order to run an update, a SqlDriver is required in order to actually run update queries within an AfterVersion. Due to the fact that the callback is provided as a parameter to the AndroidSqliteDriver constructor, this makes it difficult to get the database to do updates without wrapping the existing AndroidSqliteDriver.Callback or a SupportSQLiteOpenHelper.Callback instead. This patch adds the SqlDriver as a parameter to the AfterVersion lambda to make this easier. Fixes #2534 and fixes #2614. * Use it to avoid shadowing database * Make change binary compatible * Revert file accidentally changed * Add a comment * Rename to AfterVersionWithDriver * Rename extension function * Comment typos * Run spotless Co-authored-by: Alec Strong <astrong@squareup.com>
* master: (119 commits) Bump actions/cache from 2.1.6 to 2.1.7 (#2691) Prepare next development version. Prepare for release 1.5.3 Open JdbcDriver for 3rd party driver implementations (#2672) Add missing functions for time increments (#2671) Create a shared config which also increases the heap gradle testkit uses (#2668) Update a bunch of deps Docs: Add instructions how to apply the snapshot repo (#2662) Bump Coroutines to 1.5.2 to support Apple Arm targets Add M1 targets for coroutines-extensions Update index.md (#2642) Don't extract variables for duplicate array parameters Distribute sqldelight-android-paging3 as JAR instead of AAR (#2634) Find usages processing requires a read action (#2632) add kotlin.mpp.enableCompatibilityMetadataVariant. (#2628) Prepare next development version. Prepare for release 1.5.2 Provide SqlDriver as a parameter to AfterVersion (#2618) Update sql-psi to 0.3.15 (#2622) Sqlite keyword completion (#2616) ...
* Flatten listener list to reduce allocations and pointer chasing. * Restore query identifier tracking in Transaction to skip repeated insertions. * Update all text fixtures. * Fix listener callouts not deduplicated. * Fix extension tests. * Add highlighting for column names, stmt names, function names (#2353) * Fix unused column inspection (#2360) * Add nested class support to import inspection and class annotator (#2362) * Add remaining query generation actions (#2364) closes(?) #489 * Fix npe in CopyPasteProcessor (#2365) closes #2363 * Fix crash in InlayParameterHintsProvider (#2366) Seems like a broken index in ide cc: @YiffyToys closes #2359 * Bump Paging3 version to 3.0.0 stable * Show parameter hints from insert-stmt closes #2392 * Revert "Show parameter hints from insert-stmt" (#2395) This reverts commit a5aab3e * Show parameter hints from insert-stmt (#2396) closes #2392 (cherry picked from commit a5aab3e) * Table alias intention action (#2390) * Kpg/remove multiple transactions (#2391) * Remove multiple transactions * Bump sqliter to 1.0.2 * Formatting cleanup * Relax the reader pool test a bit * Add watchosX64 support, bump stately (#2398) * Correct migration callback AfterVersion range filter (#2394) Introduced in 1.5.0, SQLDelight had an off-by-one error for determining when to invoke an AfterMigration callback. This commit corrects the version range for which callbacks are invoked. Closes #2393. * Qualify column name intention (#2405) hell yea, love that it shows you which tables have that column name * Update rebase.yml * Update and rename rebase.yml to commands.yml * Update commands.yml * Update and rename commands.yml to rebase.yml * Create spotless.yaml * Delete spotless.yaml * Renaming android test folder to correct name Otherwise they are not actually run at all. * Kotlin 1.5 build (#2410) * Kotlin 1.5 build * Sample without web for now * Maybe fix JS sample * Bump pygments from 2.6.1 to 2.7.4 in /.github/workflows (#2413) Bumps [pygments](https://github.com/pygments/pygments) from 2.6.1 to 2.7.4. - [Release notes](https://github.com/pygments/pygments/releases) - [Changelog](https://github.com/pygments/pygments/blob/master/CHANGES) - [Commits](pygments/pygments@2.6.1...2.7.4) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix subscription / disposal race leak (#2408) * Add failing test This test reproduces the race described in #2403 for RxJava 2. * Add failing test This test reproduces the race described in #2403 for RxJava 3. * Fix subscription / disposal race This fixes the race described in #2403 for both RxJava 2 and RxJava 3. The two parent commits added failing tests, which are now passing. * Fix subscription / disposal race leak (#2408) * Add failing test This test reproduces the race described in #2403 for RxJava 2. * Add failing test This test reproduces the race described in #2403 for RxJava 3. * Fix subscription / disposal race This fixes the race described in #2403 for both RxJava 2 and RxJava 3. The two parent commits added failing tests, which are now passing. * Upgrade sql.js to 1.5.0 * Go to declaration for kotlin property (#2420) * Add a test to validate we trigger a notification synchronously on collect * Ensure we register query listener before notifying Avoid a race condition between these events by propagating the initial notification through the same mechanism that the listner uses. With this we can register the listener and then start the notification loop which will immediately trigger having been seeded with an initial notification. * Replace deprecated IntelliJ Platform Artifacts Repositories url (#2422) * Redirect questions automatically to GitHub Discussions (#2453) * Redirect questions automatically to Stack Overflow * Redirect questions to GitHub Discussions instead * Add inspection for redundant not null check relates to #2332 * Call close() on connection before clearing the ThreadLocal * Update IntelliJ Gradle plugin to avoid using Bintray * Bump kotlinx.html to version on Maven Central * Fix insertion of blank lines when copy-pasting any text into create table stmt Fixes #2431 * Add dependabot for updating GitHub Actions * Remove standalone action for validating Gradle wrapper We validate on PR builds. * Bump actions/cache from 2.1.0 to 2.1.6 Bumps [actions/cache](https://github.com/actions/cache) from 2.1.0 to 2.1.6. - [Release notes](https://github.com/actions/cache/releases) - [Commits](actions/cache@v2.1.0...v2.1.6) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Bump cirrus-actions/rebase from 1.4 to 1.5 Bumps [cirrus-actions/rebase](https://github.com/cirrus-actions/rebase) from 1.4 to 1.5. - [Release notes](https://github.com/cirrus-actions/rebase/releases) - [Commits](cirrus-actions/rebase@1.4...1.5) --- updated-dependencies: - dependency-name: cirrus-actions/rebase dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Don't annotate select query class properties with `@JvmField` - Kotlin 1.5.20 produces a warning when a constructor property type that is an inline class is annotated with `@JvmField` - Since there is no way to know if the property is an inline class at compile time, `@JvmField` should be removed for now until there's a solution - if there ever is one * Update docs to reflect Webpack 5 requirements Use config.resolve to disable polyfills Add crypto to disabled fallbacks to suppress warning Use latest copy-webpack-plugin API * Use GitHub Issue Forms for all templates (#2468) * Update sql psi to 0.3.14 (#2482) * Prepare for release 1.5.1 * Prepare next development version. * Adds descriptions to intention actions (#2489) fixes #2399 * Upgrade Android Gradle Plugin * Upgrade Spotless and ktlint * Remove unnecessary Bintray repository url * Remove explicit setting of JVM target * Fix update live template The default name for an update statement started with "delete" instead of "update". * Clarify the error for the lowercase 'as' in column type * Log unexpected types in SqlDelightFindUsagesProvider (#2506) relates to #2367 * Catch ClassCastException in CopyPasteProcessor closes #2369 * Reuse encode function result for duplicate types * Mangle kotlin keywords in arguments inside insert stmt closes #2433 * Remove unnecessary IntelliJ Platform Artifacts Repositories urls (#2494) * Fix npe in SqlDelightFoldingBuilder closes #2382 * Mixed named and positional parameters inspection closes? #470 * Propagate generateDatabaseInterface task dependency to potential consumers (#2518) * Carry task dependency * more idiomatic * add a test * make registerTaskDependency a no-op for non-Android projects * trigger a new CI build as the previous one was cancelled * remove registerTaskDependency altogether, it doesn't seem needed anymore * Add inspection suppressor (#2519) * Fix npe in SqlDelightGotoDeclarationHandler * Add ROW_COUNT function to mysql (#2523) * Update ide plugin deps (#2525) * Issue template: render Gradle Build script (#2493) * Stop invoking `forDatabaseFiles` callback on directories (#2532) It's possible that a consuming codebase could have a directory with the suffix `.db`. Therefore, SQLDelight would assume that a migration was being performed, and execute the task `verifyMainDatabaseMigration`. Since the "file" that was collected was actually a directory, and not a database file, the task would fail by trying to parse a number from the prefix contents of the directory name. This commit simplifies database file collection using Kotlin's FileTreeWalk extension function `File.walk`. We ensure that callbacks are invoked only for a File if `File.isFile` is true. References #2381. * Make VerifyMigrationTask support Gradle's up-to-date checks (#2533) * Add linuxX64 support (#2456) * Add linux support * Add missing platform specific files and fix config of linux target * Fix thread vars for linux * Configure compilation depending on host. Based on: https://youtrack.jetbrains.com/issue/KT-30498 * Update workflows * Add comment * Bump sqliter version to `1.0.5` and change cross compilation config back to match sqliter config * Remove mavenLocal repository * Change ubuntu version from `ubuntu-latest` to `ubuntu-18.04` for steps `Run gradle plugin tests` and `Run gradle plugin integrations` * Bump sqliter version to `1.0.6` * Replace all usages of `ubuntu-latest` with `ubuntu-18.04` and add a comment why this is needed * Explicitly setup jdk 11 instead of vm defaults * Bump actions/setup-java from 1 to 2.3.0 (#2547) * HMPP support (#2548) * HMPP support * Adding two newlines to trigger a new CI run The previous CI run failed on > Task :drivers:native-driver:linuxX64Test com.squareup.sqldelight.drivers.native.connectionpool.WalConcurrencyTest.manyReads FAILED kotlin.AssertionError Double checking whether it was transient or a new issue * Add M1 targets * Don't warn with "Join compares two columns of different types" when joining nullable with non-nullable type (#2550) * Update pip requirements path for Github Actions website publishing (#2552) * Update migrations.md (#2570) On iOS we were experiencing a crash because we had added BEGIN/END TRANSACTION to our migrations. The error message indicated that a transaction had been nested – we checked the documentation and didn't find any mention of transactions running in a transaction, so it seemed like a good idea to mention it here. * Fix linux publication task execution (#2557) * Topologically sort table creation statemenets * Fix windows publication task execution * Add mingwX86 target. (#2558) * set Java compatibility to 8 (#2571) * Fix IDE autocomplete for generated files for Android (#2573) * Call variant.addJavaSourceFoldersToModel for Android Studio to pickup the generated directory * run ./gradlew spotlessApply * Update sample to use gradle 7.0 (#2594) * Properly handle nulls for find usages (#2595) * explicitely require Gradle 7.0 (#2572) * Remove unnecessary nonnull cast (#2596) * Wrap PsiElement.generatedVirtualFiles into read action (#2599) Closes #2526 * Add description for UnusedColumnInspection (#2600) Closes #2510 * Bump actions/setup-java from 2.3.0 to 2.3.1 Bumps [actions/setup-java](https://github.com/actions/setup-java) from 2.3.0 to 2.3.1. - [Release notes](https://github.com/actions/setup-java/releases) - [Commits](actions/setup-java@v2.3.0...v2.3.1) --- updated-dependencies: - dependency-name: actions/setup-java dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Fix IndexOutOfBoundsException in MismatchJoinColumnInspection (#2602) Closes #2419 * Fix npe in JavaTypeMixin (#2603) Closes #2542 * Let the IDE schedule SQLDelight syncronization * Ignore flaky WAL test (#2606) * Add more information for package name errors (#2604) * Run the database sync write inside of a write action (#2605) * Avoid crashing during the unused query inspection (#2610) * If the associated virtual file is null, the module is null (#2607) * Do not reparse under a new dialect if the project is already disposed (#2609) * Add NULL comparison inspection * Sqlite keyword completion (#2616) * Sqlite keyword completion * Update broken tests * Update sql-psi to 0.3.15 (#2622) * Provide SqlDriver as a parameter to AfterVersion (#2618) * Provide SqlDriver as a parameter to AfterVersion In order to run an update, a SqlDriver is required in order to actually run update queries within an AfterVersion. Due to the fact that the callback is provided as a parameter to the AndroidSqliteDriver constructor, this makes it difficult to get the database to do updates without wrapping the existing AndroidSqliteDriver.Callback or a SupportSQLiteOpenHelper.Callback instead. This patch adds the SqlDriver as a parameter to the AfterVersion lambda to make this easier. Fixes #2534 and fixes #2614. * Use it to avoid shadowing database * Make change binary compatible * Revert file accidentally changed * Add a comment * Rename to AfterVersionWithDriver * Rename extension function * Comment typos * Run spotless Co-authored-by: Alec Strong <astrong@squareup.com> * Prepare for release 1.5.2 * Prepare next development version. * add kotlin.mpp.enableCompatibilityMetadataVariant. (#2628) Thanks @PaulWoitaschek for the heads up * Find usages processing requires a read action (#2632) * Distribute sqldelight-android-paging3 as JAR instead of AAR (#2634) Switch the sqldelight-android-paging3 module from an Android one to a JVM one. This module doesn't actually rely on any Android specifics and distributing it as an .JAR instead of an .AAR will allow it to be used from within other java (i.e. non-android) modules. Fixes #2633 * Don't extract variables for duplicate array parameters Fixes #2639 * Update index.md (#2642) Clarify that the 'com.squareup.sqldelight' gradle plugin must be placed in the app or module level build.gradle file. * Add M1 targets for coroutines-extensions * Bump Coroutines to 1.5.2 to support Apple Arm targets * Docs: Add instructions how to apply the snapshot repo (#2662) * Add instructions how to apply the snapshot repo * Fix missing close tag * Update a bunch of deps * Create a shared config which also increases the heap gradle testkit uses (#2668) * Add missing functions for time increments (#2671) The functions supported are seemingly random. I added the missing increments as per mysql docs https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html * Open JdbcDriver for 3rd party driver implementations (#2672) * Open JdbcDriver for 3rd party driver implementations * Add Kdoc Co-authored-by: hfhbd <hfhbd@users.noreply.github.com> * Prepare for release 1.5.3 * Prepare next development version. * Bump actions/cache from 2.1.6 to 2.1.7 (#2691) Bumps [actions/cache](https://github.com/actions/cache) from 2.1.6 to 2.1.7. - [Release notes](https://github.com/actions/cache/releases) - [Commits](actions/cache@v2.1.6...v2.1.7) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update rx tests * Update test database gen Co-authored-by: Anders Ha <anders@andersha.com> Co-authored-by: Alexander Perfilyev <alexander.perfilyev@gmail.com> Co-authored-by: Kevin Cianfarini <kevincianfarini@gmail.com> Co-authored-by: Kevin Galligan <kgalligan@gmail.com> Co-authored-by: Kevin Cianfarini <kcianfarini@squareup.com> Co-authored-by: Benoit Quenaudon <bquenaudon@squareup.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: py - Pierre Yves Ricau <pyricau@users.noreply.github.com> Co-authored-by: Derek <derek@llamabagel.ca> Co-authored-by: Jake Wharton <jw@squareup.com> Co-authored-by: Veyndan Stuart <veyndan@gmail.com> Co-authored-by: Hannes Struß <x@hannesstruss.de> Co-authored-by: Eliezer Graber <eygraber@gmail.com> Co-authored-by: Ilias Redissi <4529265+IliasRedissi@users.noreply.github.com> Co-authored-by: Martin Bonnin <martin@mbonnin.net> Co-authored-by: dev-m1-macbook <86197260+dev-m1-macbook@users.noreply.github.com> Co-authored-by: Niklas Baudy <niklas.baudy@vanniktech.de> Co-authored-by: Matthew Haughton <3flex@users.noreply.github.com> Co-authored-by: Cedric Hippmann <cedric.hippmann@hotmail.com> Co-authored-by: Piotr Chmielowski <piotr.a.chmielowski@gmail.com> Co-authored-by: John Rodriguez <john.rodriguez@gmail.com> Co-authored-by: Colin T.A. Gray <colinta@gmail.com> Co-authored-by: Nikita Kozhemyakin <enginegl.ec@gmail.com> Co-authored-by: Ahmed El-Helw <ahmedre@gmail.com> Co-authored-by: Marco Romano <marcojulioromano@gmail.com> Co-authored-by: Brylle <55132223+hi-brylle@users.noreply.github.com> Co-authored-by: Philip Dukhov <philip.dukhov@gmail.com> Co-authored-by: Philip Wedemann <22521688+hfhbd@users.noreply.github.com> Co-authored-by: Sam Doward <sam.doward@gmail.com> Co-authored-by: hfhbd <hfhbd@users.noreply.github.com>
* Provide SqlDriver as a parameter to AfterVersion In order to run an update, a SqlDriver is required in order to actually run update queries within an AfterVersion. Due to the fact that the callback is provided as a parameter to the AndroidSqliteDriver constructor, this makes it difficult to get the database to do updates without wrapping the existing AndroidSqliteDriver.Callback or a SupportSQLiteOpenHelper.Callback instead. This patch adds the SqlDriver as a parameter to the AfterVersion lambda to make this easier. Fixes #2534 and fixes #2614. * Use it to avoid shadowing database * Make change binary compatible * Revert file accidentally changed * Add a comment * Rename to AfterVersionWithDriver * Rename extension function * Comment typos * Run spotless Co-authored-by: Alec Strong <astrong@squareup.com>
* Flatten listener list to reduce allocations and pointer chasing. * Restore query identifier tracking in Transaction to skip repeated insertions. * Update all text fixtures. * Fix listener callouts not deduplicated. * Fix extension tests. * Add highlighting for column names, stmt names, function names (#2353) * Fix unused column inspection (#2360) * Add nested class support to import inspection and class annotator (#2362) * Add remaining query generation actions (#2364) closes(?) #489 * Fix npe in CopyPasteProcessor (#2365) closes #2363 * Fix crash in InlayParameterHintsProvider (#2366) Seems like a broken index in ide cc: @YiffyToys closes #2359 * Bump Paging3 version to 3.0.0 stable * Show parameter hints from insert-stmt closes #2392 * Revert "Show parameter hints from insert-stmt" (#2395) This reverts commit a5aab3e * Show parameter hints from insert-stmt (#2396) closes #2392 (cherry picked from commit a5aab3e) * Table alias intention action (#2390) * Kpg/remove multiple transactions (#2391) * Remove multiple transactions * Bump sqliter to 1.0.2 * Formatting cleanup * Relax the reader pool test a bit * Add watchosX64 support, bump stately (#2398) * Correct migration callback AfterVersion range filter (#2394) Introduced in 1.5.0, SQLDelight had an off-by-one error for determining when to invoke an AfterMigration callback. This commit corrects the version range for which callbacks are invoked. Closes #2393. * Qualify column name intention (#2405) hell yea, love that it shows you which tables have that column name * Update rebase.yml * Update and rename rebase.yml to commands.yml * Update commands.yml * Update and rename commands.yml to rebase.yml * Create spotless.yaml * Delete spotless.yaml * Renaming android test folder to correct name Otherwise they are not actually run at all. * Kotlin 1.5 build (#2410) * Kotlin 1.5 build * Sample without web for now * Maybe fix JS sample * Bump pygments from 2.6.1 to 2.7.4 in /.github/workflows (#2413) Bumps [pygments](https://github.com/pygments/pygments) from 2.6.1 to 2.7.4. - [Release notes](https://github.com/pygments/pygments/releases) - [Changelog](https://github.com/pygments/pygments/blob/master/CHANGES) - [Commits](pygments/pygments@2.6.1...2.7.4) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix subscription / disposal race leak (#2408) * Add failing test This test reproduces the race described in #2403 for RxJava 2. * Add failing test This test reproduces the race described in #2403 for RxJava 3. * Fix subscription / disposal race This fixes the race described in #2403 for both RxJava 2 and RxJava 3. The two parent commits added failing tests, which are now passing. * Fix subscription / disposal race leak (#2408) * Add failing test This test reproduces the race described in #2403 for RxJava 2. * Add failing test This test reproduces the race described in #2403 for RxJava 3. * Fix subscription / disposal race This fixes the race described in #2403 for both RxJava 2 and RxJava 3. The two parent commits added failing tests, which are now passing. * Upgrade sql.js to 1.5.0 * Go to declaration for kotlin property (#2420) * Add a test to validate we trigger a notification synchronously on collect * Ensure we register query listener before notifying Avoid a race condition between these events by propagating the initial notification through the same mechanism that the listner uses. With this we can register the listener and then start the notification loop which will immediately trigger having been seeded with an initial notification. * Replace deprecated IntelliJ Platform Artifacts Repositories url (#2422) * Redirect questions automatically to GitHub Discussions (#2453) * Redirect questions automatically to Stack Overflow * Redirect questions to GitHub Discussions instead * Add inspection for redundant not null check relates to #2332 * Call close() on connection before clearing the ThreadLocal * Update IntelliJ Gradle plugin to avoid using Bintray * Bump kotlinx.html to version on Maven Central * Fix insertion of blank lines when copy-pasting any text into create table stmt Fixes #2431 * Add dependabot for updating GitHub Actions * Remove standalone action for validating Gradle wrapper We validate on PR builds. * Bump actions/cache from 2.1.0 to 2.1.6 Bumps [actions/cache](https://github.com/actions/cache) from 2.1.0 to 2.1.6. - [Release notes](https://github.com/actions/cache/releases) - [Commits](actions/cache@v2.1.0...v2.1.6) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Bump cirrus-actions/rebase from 1.4 to 1.5 Bumps [cirrus-actions/rebase](https://github.com/cirrus-actions/rebase) from 1.4 to 1.5. - [Release notes](https://github.com/cirrus-actions/rebase/releases) - [Commits](cirrus-actions/rebase@1.4...1.5) --- updated-dependencies: - dependency-name: cirrus-actions/rebase dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Don't annotate select query class properties with `@JvmField` - Kotlin 1.5.20 produces a warning when a constructor property type that is an inline class is annotated with `@JvmField` - Since there is no way to know if the property is an inline class at compile time, `@JvmField` should be removed for now until there's a solution - if there ever is one * Update docs to reflect Webpack 5 requirements Use config.resolve to disable polyfills Add crypto to disabled fallbacks to suppress warning Use latest copy-webpack-plugin API * Use GitHub Issue Forms for all templates (#2468) * Update sql psi to 0.3.14 (#2482) * Prepare for release 1.5.1 * Prepare next development version. * Adds descriptions to intention actions (#2489) fixes #2399 * Upgrade Android Gradle Plugin * Upgrade Spotless and ktlint * Remove unnecessary Bintray repository url * Remove explicit setting of JVM target * Fix update live template The default name for an update statement started with "delete" instead of "update". * Clarify the error for the lowercase 'as' in column type * Log unexpected types in SqlDelightFindUsagesProvider (#2506) relates to #2367 * Catch ClassCastException in CopyPasteProcessor closes #2369 * Reuse encode function result for duplicate types * Mangle kotlin keywords in arguments inside insert stmt closes #2433 * Remove unnecessary IntelliJ Platform Artifacts Repositories urls (#2494) * Fix npe in SqlDelightFoldingBuilder closes #2382 * Mixed named and positional parameters inspection closes? #470 * Propagate generateDatabaseInterface task dependency to potential consumers (#2518) * Carry task dependency * more idiomatic * add a test * make registerTaskDependency a no-op for non-Android projects * trigger a new CI build as the previous one was cancelled * remove registerTaskDependency altogether, it doesn't seem needed anymore * Add inspection suppressor (#2519) * Fix npe in SqlDelightGotoDeclarationHandler * Add ROW_COUNT function to mysql (#2523) * Update ide plugin deps (#2525) * Issue template: render Gradle Build script (#2493) * Stop invoking `forDatabaseFiles` callback on directories (#2532) It's possible that a consuming codebase could have a directory with the suffix `.db`. Therefore, SQLDelight would assume that a migration was being performed, and execute the task `verifyMainDatabaseMigration`. Since the "file" that was collected was actually a directory, and not a database file, the task would fail by trying to parse a number from the prefix contents of the directory name. This commit simplifies database file collection using Kotlin's FileTreeWalk extension function `File.walk`. We ensure that callbacks are invoked only for a File if `File.isFile` is true. References #2381. * Make VerifyMigrationTask support Gradle's up-to-date checks (#2533) * Add linuxX64 support (#2456) * Add linux support * Add missing platform specific files and fix config of linux target * Fix thread vars for linux * Configure compilation depending on host. Based on: https://youtrack.jetbrains.com/issue/KT-30498 * Update workflows * Add comment * Bump sqliter version to `1.0.5` and change cross compilation config back to match sqliter config * Remove mavenLocal repository * Change ubuntu version from `ubuntu-latest` to `ubuntu-18.04` for steps `Run gradle plugin tests` and `Run gradle plugin integrations` * Bump sqliter version to `1.0.6` * Replace all usages of `ubuntu-latest` with `ubuntu-18.04` and add a comment why this is needed * Explicitly setup jdk 11 instead of vm defaults * Bump actions/setup-java from 1 to 2.3.0 (#2547) * HMPP support (#2548) * HMPP support * Adding two newlines to trigger a new CI run The previous CI run failed on > Task :drivers:native-driver:linuxX64Test com.squareup.sqldelight.drivers.native.connectionpool.WalConcurrencyTest.manyReads FAILED kotlin.AssertionError Double checking whether it was transient or a new issue * Add M1 targets * Don't warn with "Join compares two columns of different types" when joining nullable with non-nullable type (#2550) * Update pip requirements path for Github Actions website publishing (#2552) * Update migrations.md (#2570) On iOS we were experiencing a crash because we had added BEGIN/END TRANSACTION to our migrations. The error message indicated that a transaction had been nested – we checked the documentation and didn't find any mention of transactions running in a transaction, so it seemed like a good idea to mention it here. * Fix linux publication task execution (#2557) * Topologically sort table creation statemenets * Fix windows publication task execution * Add mingwX86 target. (#2558) * set Java compatibility to 8 (#2571) * Fix IDE autocomplete for generated files for Android (#2573) * Call variant.addJavaSourceFoldersToModel for Android Studio to pickup the generated directory * run ./gradlew spotlessApply * Update sample to use gradle 7.0 (#2594) * Properly handle nulls for find usages (#2595) * explicitely require Gradle 7.0 (#2572) * Remove unnecessary nonnull cast (#2596) * Wrap PsiElement.generatedVirtualFiles into read action (#2599) Closes #2526 * Add description for UnusedColumnInspection (#2600) Closes #2510 * Bump actions/setup-java from 2.3.0 to 2.3.1 Bumps [actions/setup-java](https://github.com/actions/setup-java) from 2.3.0 to 2.3.1. - [Release notes](https://github.com/actions/setup-java/releases) - [Commits](actions/setup-java@v2.3.0...v2.3.1) --- updated-dependencies: - dependency-name: actions/setup-java dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Fix IndexOutOfBoundsException in MismatchJoinColumnInspection (#2602) Closes #2419 * Fix npe in JavaTypeMixin (#2603) Closes #2542 * Let the IDE schedule SQLDelight syncronization * Ignore flaky WAL test (#2606) * Add more information for package name errors (#2604) * Run the database sync write inside of a write action (#2605) * Avoid crashing during the unused query inspection (#2610) * If the associated virtual file is null, the module is null (#2607) * Do not reparse under a new dialect if the project is already disposed (#2609) * Add NULL comparison inspection * Sqlite keyword completion (#2616) * Sqlite keyword completion * Update broken tests * Update sql-psi to 0.3.15 (#2622) * Provide SqlDriver as a parameter to AfterVersion (#2618) * Provide SqlDriver as a parameter to AfterVersion In order to run an update, a SqlDriver is required in order to actually run update queries within an AfterVersion. Due to the fact that the callback is provided as a parameter to the AndroidSqliteDriver constructor, this makes it difficult to get the database to do updates without wrapping the existing AndroidSqliteDriver.Callback or a SupportSQLiteOpenHelper.Callback instead. This patch adds the SqlDriver as a parameter to the AfterVersion lambda to make this easier. Fixes #2534 and fixes #2614. * Use it to avoid shadowing database * Make change binary compatible * Revert file accidentally changed * Add a comment * Rename to AfterVersionWithDriver * Rename extension function * Comment typos * Run spotless Co-authored-by: Alec Strong <astrong@squareup.com> * Prepare for release 1.5.2 * Prepare next development version. * add kotlin.mpp.enableCompatibilityMetadataVariant. (#2628) Thanks @PaulWoitaschek for the heads up * Find usages processing requires a read action (#2632) * Distribute sqldelight-android-paging3 as JAR instead of AAR (#2634) Switch the sqldelight-android-paging3 module from an Android one to a JVM one. This module doesn't actually rely on any Android specifics and distributing it as an .JAR instead of an .AAR will allow it to be used from within other java (i.e. non-android) modules. Fixes #2633 * Don't extract variables for duplicate array parameters Fixes #2639 * Update index.md (#2642) Clarify that the 'com.squareup.sqldelight' gradle plugin must be placed in the app or module level build.gradle file. * Add M1 targets for coroutines-extensions * Bump Coroutines to 1.5.2 to support Apple Arm targets * Docs: Add instructions how to apply the snapshot repo (#2662) * Add instructions how to apply the snapshot repo * Fix missing close tag * Update a bunch of deps * Create a shared config which also increases the heap gradle testkit uses (#2668) * Add missing functions for time increments (#2671) The functions supported are seemingly random. I added the missing increments as per mysql docs https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html * Open JdbcDriver for 3rd party driver implementations (#2672) * Open JdbcDriver for 3rd party driver implementations * Add Kdoc Co-authored-by: hfhbd <hfhbd@users.noreply.github.com> * Prepare for release 1.5.3 * Prepare next development version. * Bump actions/cache from 2.1.6 to 2.1.7 (#2691) Bumps [actions/cache](https://github.com/actions/cache) from 2.1.6 to 2.1.7. - [Release notes](https://github.com/actions/cache/releases) - [Commits](actions/cache@v2.1.6...v2.1.7) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update rx tests * Update test database gen Co-authored-by: Anders Ha <anders@andersha.com> Co-authored-by: Alexander Perfilyev <alexander.perfilyev@gmail.com> Co-authored-by: Kevin Cianfarini <kevincianfarini@gmail.com> Co-authored-by: Kevin Galligan <kgalligan@gmail.com> Co-authored-by: Kevin Cianfarini <kcianfarini@squareup.com> Co-authored-by: Benoit Quenaudon <bquenaudon@squareup.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: py - Pierre Yves Ricau <pyricau@users.noreply.github.com> Co-authored-by: Derek <derek@llamabagel.ca> Co-authored-by: Jake Wharton <jw@squareup.com> Co-authored-by: Veyndan Stuart <veyndan@gmail.com> Co-authored-by: Hannes Struß <x@hannesstruss.de> Co-authored-by: Eliezer Graber <eygraber@gmail.com> Co-authored-by: Ilias Redissi <4529265+IliasRedissi@users.noreply.github.com> Co-authored-by: Martin Bonnin <martin@mbonnin.net> Co-authored-by: dev-m1-macbook <86197260+dev-m1-macbook@users.noreply.github.com> Co-authored-by: Niklas Baudy <niklas.baudy@vanniktech.de> Co-authored-by: Matthew Haughton <3flex@users.noreply.github.com> Co-authored-by: Cedric Hippmann <cedric.hippmann@hotmail.com> Co-authored-by: Piotr Chmielowski <piotr.a.chmielowski@gmail.com> Co-authored-by: John Rodriguez <john.rodriguez@gmail.com> Co-authored-by: Colin T.A. Gray <colinta@gmail.com> Co-authored-by: Nikita Kozhemyakin <enginegl.ec@gmail.com> Co-authored-by: Ahmed El-Helw <ahmedre@gmail.com> Co-authored-by: Marco Romano <marcojulioromano@gmail.com> Co-authored-by: Brylle <55132223+hi-brylle@users.noreply.github.com> Co-authored-by: Philip Dukhov <philip.dukhov@gmail.com> Co-authored-by: Philip Wedemann <22521688+hfhbd@users.noreply.github.com> Co-authored-by: Sam Doward <sam.doward@gmail.com> Co-authored-by: hfhbd <hfhbd@users.noreply.github.com>
* Provide SqlDriver as a parameter to AfterVersion In order to run an update, a SqlDriver is required in order to actually run update queries within an AfterVersion. Due to the fact that the callback is provided as a parameter to the AndroidSqliteDriver constructor, this makes it difficult to get the database to do updates without wrapping the existing AndroidSqliteDriver.Callback or a SupportSQLiteOpenHelper.Callback instead. This patch adds the SqlDriver as a parameter to the AfterVersion lambda to make this easier. Fixes sqldelight#2534 and fixes sqldelight#2614. * Use it to avoid shadowing database * Make change binary compatible * Revert file accidentally changed * Add a comment * Rename to AfterVersionWithDriver * Rename extension function * Comment typos * Run spotless Co-authored-by: Alec Strong <astrong@squareup.com>
* Flatten listener list to reduce allocations and pointer chasing. * Restore query identifier tracking in Transaction to skip repeated insertions. * Update all text fixtures. * Fix listener callouts not deduplicated. * Fix extension tests. * Add highlighting for column names, stmt names, function names (sqldelight#2353) * Fix unused column inspection (sqldelight#2360) * Add nested class support to import inspection and class annotator (sqldelight#2362) * Add remaining query generation actions (sqldelight#2364) closes(?) sqldelight#489 * Fix npe in CopyPasteProcessor (sqldelight#2365) closes sqldelight#2363 * Fix crash in InlayParameterHintsProvider (sqldelight#2366) Seems like a broken index in ide cc: @YiffyToys closes sqldelight#2359 * Bump Paging3 version to 3.0.0 stable * Show parameter hints from insert-stmt closes sqldelight#2392 * Revert "Show parameter hints from insert-stmt" (sqldelight#2395) This reverts commit a5aab3e * Show parameter hints from insert-stmt (sqldelight#2396) closes sqldelight#2392 (cherry picked from commit a5aab3e) * Table alias intention action (sqldelight#2390) * Kpg/remove multiple transactions (sqldelight#2391) * Remove multiple transactions * Bump sqliter to 1.0.2 * Formatting cleanup * Relax the reader pool test a bit * Add watchosX64 support, bump stately (sqldelight#2398) * Correct migration callback AfterVersion range filter (sqldelight#2394) Introduced in 1.5.0, SQLDelight had an off-by-one error for determining when to invoke an AfterMigration callback. This commit corrects the version range for which callbacks are invoked. Closes sqldelight#2393. * Qualify column name intention (sqldelight#2405) hell yea, love that it shows you which tables have that column name * Update rebase.yml * Update and rename rebase.yml to commands.yml * Update commands.yml * Update and rename commands.yml to rebase.yml * Create spotless.yaml * Delete spotless.yaml * Renaming android test folder to correct name Otherwise they are not actually run at all. * Kotlin 1.5 build (sqldelight#2410) * Kotlin 1.5 build * Sample without web for now * Maybe fix JS sample * Bump pygments from 2.6.1 to 2.7.4 in /.github/workflows (sqldelight#2413) Bumps [pygments](https://github.com/pygments/pygments) from 2.6.1 to 2.7.4. - [Release notes](https://github.com/pygments/pygments/releases) - [Changelog](https://github.com/pygments/pygments/blob/master/CHANGES) - [Commits](pygments/pygments@2.6.1...2.7.4) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix subscription / disposal race leak (sqldelight#2408) * Add failing test This test reproduces the race described in sqldelight#2403 for RxJava 2. * Add failing test This test reproduces the race described in sqldelight#2403 for RxJava 3. * Fix subscription / disposal race This fixes the race described in sqldelight#2403 for both RxJava 2 and RxJava 3. The two parent commits added failing tests, which are now passing. * Fix subscription / disposal race leak (sqldelight#2408) * Add failing test This test reproduces the race described in sqldelight#2403 for RxJava 2. * Add failing test This test reproduces the race described in sqldelight#2403 for RxJava 3. * Fix subscription / disposal race This fixes the race described in sqldelight#2403 for both RxJava 2 and RxJava 3. The two parent commits added failing tests, which are now passing. * Upgrade sql.js to 1.5.0 * Go to declaration for kotlin property (sqldelight#2420) * Add a test to validate we trigger a notification synchronously on collect * Ensure we register query listener before notifying Avoid a race condition between these events by propagating the initial notification through the same mechanism that the listner uses. With this we can register the listener and then start the notification loop which will immediately trigger having been seeded with an initial notification. * Replace deprecated IntelliJ Platform Artifacts Repositories url (sqldelight#2422) * Redirect questions automatically to GitHub Discussions (sqldelight#2453) * Redirect questions automatically to Stack Overflow * Redirect questions to GitHub Discussions instead * Add inspection for redundant not null check relates to sqldelight#2332 * Call close() on connection before clearing the ThreadLocal * Update IntelliJ Gradle plugin to avoid using Bintray * Bump kotlinx.html to version on Maven Central * Fix insertion of blank lines when copy-pasting any text into create table stmt Fixes sqldelight#2431 * Add dependabot for updating GitHub Actions * Remove standalone action for validating Gradle wrapper We validate on PR builds. * Bump actions/cache from 2.1.0 to 2.1.6 Bumps [actions/cache](https://github.com/actions/cache) from 2.1.0 to 2.1.6. - [Release notes](https://github.com/actions/cache/releases) - [Commits](actions/cache@v2.1.0...v2.1.6) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Bump cirrus-actions/rebase from 1.4 to 1.5 Bumps [cirrus-actions/rebase](https://github.com/cirrus-actions/rebase) from 1.4 to 1.5. - [Release notes](https://github.com/cirrus-actions/rebase/releases) - [Commits](cirrus-actions/rebase@1.4...1.5) --- updated-dependencies: - dependency-name: cirrus-actions/rebase dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Don't annotate select query class properties with `@JvmField` - Kotlin 1.5.20 produces a warning when a constructor property type that is an inline class is annotated with `@JvmField` - Since there is no way to know if the property is an inline class at compile time, `@JvmField` should be removed for now until there's a solution - if there ever is one * Update docs to reflect Webpack 5 requirements Use config.resolve to disable polyfills Add crypto to disabled fallbacks to suppress warning Use latest copy-webpack-plugin API * Use GitHub Issue Forms for all templates (sqldelight#2468) * Update sql psi to 0.3.14 (sqldelight#2482) * Prepare for release 1.5.1 * Prepare next development version. * Adds descriptions to intention actions (sqldelight#2489) fixes sqldelight#2399 * Upgrade Android Gradle Plugin * Upgrade Spotless and ktlint * Remove unnecessary Bintray repository url * Remove explicit setting of JVM target * Fix update live template The default name for an update statement started with "delete" instead of "update". * Clarify the error for the lowercase 'as' in column type * Log unexpected types in SqlDelightFindUsagesProvider (sqldelight#2506) relates to sqldelight#2367 * Catch ClassCastException in CopyPasteProcessor closes sqldelight#2369 * Reuse encode function result for duplicate types * Mangle kotlin keywords in arguments inside insert stmt closes sqldelight#2433 * Remove unnecessary IntelliJ Platform Artifacts Repositories urls (sqldelight#2494) * Fix npe in SqlDelightFoldingBuilder closes sqldelight#2382 * Mixed named and positional parameters inspection closes? sqldelight#470 * Propagate generateDatabaseInterface task dependency to potential consumers (sqldelight#2518) * Carry task dependency * more idiomatic * add a test * make registerTaskDependency a no-op for non-Android projects * trigger a new CI build as the previous one was cancelled * remove registerTaskDependency altogether, it doesn't seem needed anymore * Add inspection suppressor (sqldelight#2519) * Fix npe in SqlDelightGotoDeclarationHandler * Add ROW_COUNT function to mysql (sqldelight#2523) * Update ide plugin deps (sqldelight#2525) * Issue template: render Gradle Build script (sqldelight#2493) * Stop invoking `forDatabaseFiles` callback on directories (sqldelight#2532) It's possible that a consuming codebase could have a directory with the suffix `.db`. Therefore, SQLDelight would assume that a migration was being performed, and execute the task `verifyMainDatabaseMigration`. Since the "file" that was collected was actually a directory, and not a database file, the task would fail by trying to parse a number from the prefix contents of the directory name. This commit simplifies database file collection using Kotlin's FileTreeWalk extension function `File.walk`. We ensure that callbacks are invoked only for a File if `File.isFile` is true. References sqldelight#2381. * Make VerifyMigrationTask support Gradle's up-to-date checks (sqldelight#2533) * Add linuxX64 support (sqldelight#2456) * Add linux support * Add missing platform specific files and fix config of linux target * Fix thread vars for linux * Configure compilation depending on host. Based on: https://youtrack.jetbrains.com/issue/KT-30498 * Update workflows * Add comment * Bump sqliter version to `1.0.5` and change cross compilation config back to match sqliter config * Remove mavenLocal repository * Change ubuntu version from `ubuntu-latest` to `ubuntu-18.04` for steps `Run gradle plugin tests` and `Run gradle plugin integrations` * Bump sqliter version to `1.0.6` * Replace all usages of `ubuntu-latest` with `ubuntu-18.04` and add a comment why this is needed * Explicitly setup jdk 11 instead of vm defaults * Bump actions/setup-java from 1 to 2.3.0 (sqldelight#2547) * HMPP support (sqldelight#2548) * HMPP support * Adding two newlines to trigger a new CI run The previous CI run failed on > Task :drivers:native-driver:linuxX64Test com.squareup.sqldelight.drivers.native.connectionpool.WalConcurrencyTest.manyReads FAILED kotlin.AssertionError Double checking whether it was transient or a new issue * Add M1 targets * Don't warn with "Join compares two columns of different types" when joining nullable with non-nullable type (sqldelight#2550) * Update pip requirements path for Github Actions website publishing (sqldelight#2552) * Update migrations.md (sqldelight#2570) On iOS we were experiencing a crash because we had added BEGIN/END TRANSACTION to our migrations. The error message indicated that a transaction had been nested – we checked the documentation and didn't find any mention of transactions running in a transaction, so it seemed like a good idea to mention it here. * Fix linux publication task execution (sqldelight#2557) * Topologically sort table creation statemenets * Fix windows publication task execution * Add mingwX86 target. (sqldelight#2558) * set Java compatibility to 8 (sqldelight#2571) * Fix IDE autocomplete for generated files for Android (sqldelight#2573) * Call variant.addJavaSourceFoldersToModel for Android Studio to pickup the generated directory * run ./gradlew spotlessApply * Update sample to use gradle 7.0 (sqldelight#2594) * Properly handle nulls for find usages (sqldelight#2595) * explicitely require Gradle 7.0 (sqldelight#2572) * Remove unnecessary nonnull cast (sqldelight#2596) * Wrap PsiElement.generatedVirtualFiles into read action (sqldelight#2599) Closes sqldelight#2526 * Add description for UnusedColumnInspection (sqldelight#2600) Closes sqldelight#2510 * Bump actions/setup-java from 2.3.0 to 2.3.1 Bumps [actions/setup-java](https://github.com/actions/setup-java) from 2.3.0 to 2.3.1. - [Release notes](https://github.com/actions/setup-java/releases) - [Commits](actions/setup-java@v2.3.0...v2.3.1) --- updated-dependencies: - dependency-name: actions/setup-java dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Fix IndexOutOfBoundsException in MismatchJoinColumnInspection (sqldelight#2602) Closes sqldelight#2419 * Fix npe in JavaTypeMixin (sqldelight#2603) Closes sqldelight#2542 * Let the IDE schedule SQLDelight syncronization * Ignore flaky WAL test (sqldelight#2606) * Add more information for package name errors (sqldelight#2604) * Run the database sync write inside of a write action (sqldelight#2605) * Avoid crashing during the unused query inspection (sqldelight#2610) * If the associated virtual file is null, the module is null (sqldelight#2607) * Do not reparse under a new dialect if the project is already disposed (sqldelight#2609) * Add NULL comparison inspection * Sqlite keyword completion (sqldelight#2616) * Sqlite keyword completion * Update broken tests * Update sql-psi to 0.3.15 (sqldelight#2622) * Provide SqlDriver as a parameter to AfterVersion (sqldelight#2618) * Provide SqlDriver as a parameter to AfterVersion In order to run an update, a SqlDriver is required in order to actually run update queries within an AfterVersion. Due to the fact that the callback is provided as a parameter to the AndroidSqliteDriver constructor, this makes it difficult to get the database to do updates without wrapping the existing AndroidSqliteDriver.Callback or a SupportSQLiteOpenHelper.Callback instead. This patch adds the SqlDriver as a parameter to the AfterVersion lambda to make this easier. Fixes sqldelight#2534 and fixes sqldelight#2614. * Use it to avoid shadowing database * Make change binary compatible * Revert file accidentally changed * Add a comment * Rename to AfterVersionWithDriver * Rename extension function * Comment typos * Run spotless Co-authored-by: Alec Strong <astrong@squareup.com> * Prepare for release 1.5.2 * Prepare next development version. * add kotlin.mpp.enableCompatibilityMetadataVariant. (sqldelight#2628) Thanks @PaulWoitaschek for the heads up * Find usages processing requires a read action (sqldelight#2632) * Distribute sqldelight-android-paging3 as JAR instead of AAR (sqldelight#2634) Switch the sqldelight-android-paging3 module from an Android one to a JVM one. This module doesn't actually rely on any Android specifics and distributing it as an .JAR instead of an .AAR will allow it to be used from within other java (i.e. non-android) modules. Fixes sqldelight#2633 * Don't extract variables for duplicate array parameters Fixes sqldelight#2639 * Update index.md (sqldelight#2642) Clarify that the 'com.squareup.sqldelight' gradle plugin must be placed in the app or module level build.gradle file. * Add M1 targets for coroutines-extensions * Bump Coroutines to 1.5.2 to support Apple Arm targets * Docs: Add instructions how to apply the snapshot repo (sqldelight#2662) * Add instructions how to apply the snapshot repo * Fix missing close tag * Update a bunch of deps * Create a shared config which also increases the heap gradle testkit uses (sqldelight#2668) * Add missing functions for time increments (sqldelight#2671) The functions supported are seemingly random. I added the missing increments as per mysql docs https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html * Open JdbcDriver for 3rd party driver implementations (sqldelight#2672) * Open JdbcDriver for 3rd party driver implementations * Add Kdoc Co-authored-by: hfhbd <hfhbd@users.noreply.github.com> * Prepare for release 1.5.3 * Prepare next development version. * Bump actions/cache from 2.1.6 to 2.1.7 (sqldelight#2691) Bumps [actions/cache](https://github.com/actions/cache) from 2.1.6 to 2.1.7. - [Release notes](https://github.com/actions/cache/releases) - [Commits](actions/cache@v2.1.6...v2.1.7) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update rx tests * Update test database gen Co-authored-by: Anders Ha <anders@andersha.com> Co-authored-by: Alexander Perfilyev <alexander.perfilyev@gmail.com> Co-authored-by: Kevin Cianfarini <kevincianfarini@gmail.com> Co-authored-by: Kevin Galligan <kgalligan@gmail.com> Co-authored-by: Kevin Cianfarini <kcianfarini@squareup.com> Co-authored-by: Benoit Quenaudon <bquenaudon@squareup.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: py - Pierre Yves Ricau <pyricau@users.noreply.github.com> Co-authored-by: Derek <derek@llamabagel.ca> Co-authored-by: Jake Wharton <jw@squareup.com> Co-authored-by: Veyndan Stuart <veyndan@gmail.com> Co-authored-by: Hannes Struß <x@hannesstruss.de> Co-authored-by: Eliezer Graber <eygraber@gmail.com> Co-authored-by: Ilias Redissi <4529265+IliasRedissi@users.noreply.github.com> Co-authored-by: Martin Bonnin <martin@mbonnin.net> Co-authored-by: dev-m1-macbook <86197260+dev-m1-macbook@users.noreply.github.com> Co-authored-by: Niklas Baudy <niklas.baudy@vanniktech.de> Co-authored-by: Matthew Haughton <3flex@users.noreply.github.com> Co-authored-by: Cedric Hippmann <cedric.hippmann@hotmail.com> Co-authored-by: Piotr Chmielowski <piotr.a.chmielowski@gmail.com> Co-authored-by: John Rodriguez <john.rodriguez@gmail.com> Co-authored-by: Colin T.A. Gray <colinta@gmail.com> Co-authored-by: Nikita Kozhemyakin <enginegl.ec@gmail.com> Co-authored-by: Ahmed El-Helw <ahmedre@gmail.com> Co-authored-by: Marco Romano <marcojulioromano@gmail.com> Co-authored-by: Brylle <55132223+hi-brylle@users.noreply.github.com> Co-authored-by: Philip Dukhov <philip.dukhov@gmail.com> Co-authored-by: Philip Wedemann <22521688+hfhbd@users.noreply.github.com> Co-authored-by: Sam Doward <sam.doward@gmail.com> Co-authored-by: hfhbd <hfhbd@users.noreply.github.com>
In order to run an update, a SqlDriver is required in order to actually
run update queries within an AfterVersion. Due to the fact that the
callback is provided as a parameter to the AndroidSqliteDriver
constructor, this makes it difficult to get the database to do updates
without wrapping the existing AndroidSqliteDriver.Callback or a
SupportSQLiteOpenHelper.Callback instead. This patch adds the SqlDriver
as a parameter to the AfterVersion lambda to make this easier.
Fixes #2534 and fixes #2614.