https://kotlinlang.org logo
n

Niko

07/08/2023, 7:55 AM
Migrating SQLDelight from
1.5.3
to
2.0.0-rc02
, I'm getting missing symbols errors in the generated codes about missing
Copy code
import app.cash.sqldelight.driver.r2dbc.R2dbcCursor
import app.cash.sqldelight.driver.r2dbc.R2dbcPreparedStatement
in my
build/generated/.../*Queries.kt
files. I've set up my project with
Copy code
// build.gradle.kts
// DB: SQLDelight + HikariCP + PostgreSQL + H2 + Flyway
+ val sqldelightVersion = "2.0.0-rc02"
- val sqldelightVersion = "1.5.3"
+ implementation("app.cash.sqldelight:runtime:$sqldelightVersion")
+ implementation("app.cash.sqldelight:jdbc-driver:$sqldelightVersion")
- implementation("com.squareup.sqldelight:runtime:$sqldelightVersion")
- implementation("com.squareup.sqldelight:jdbc-driver:$sqldelightVersion")
- implementation("com.squareup.sqldelight:coroutines-extensions:$sqldelightVersion")
// ^ I'm not completely sure what implementation deps there should be...

sqldelight {
    databases {
        create("LicencesDatabase") {
            packageName.set("...")
+           dialect("app.cash.sqldelight:postgresql-dialect:2.0.0-rc02")
+           srcDirs.setFrom("src/main/sqldelight")
-           sourceFolders = listOf("src/main/sqldelight")
            deriveSchemaFromMigrations.set(true)
            migrationOutputDirectory.set(file("$buildDir/resources/main/migrations"))
            migrationOutputFileFormat.set(".sql")
            verifyMigrations.set(true)
+           generateAsync.set(true)
        }
    }
}
So evidently I'm trying to generate PostgreSQL queries, but for some reason the generated files will contain `import`s to
app.cash.sqldelight.driver.r2dbc
which to my understanding should be the
jdcd-driver
instead:
Copy code
// ./build/generated/sqldelight/code/LicencesDatabase/main/.../licence/ApplicationQueries.kt
package ....licence

import app.cash.sqldelight.ExecutableQuery
import app.cash.sqldelight.Query
import app.cash.sqldelight.SuspendingTransacterImpl
import app.cash.sqldelight.db.SqlDriver
import app.cash.sqldelight.driver.r2dbc.R2dbcCursor
import kotlin.Long

public class ApplicationQueries(
  driver: SqlDriver,
) : SuspendingTransacterImpl(driver) {
  public fun check(): ExecutableQuery<Long> = Query(-1_038_206_624, driver, "application.sq",
      "check", "SELECT 1") { cursor ->
    check(cursor is R2dbcCursor)
    cursor.getLong(0)!!
  }
}
Hoping this is a simple mis-configuration from my part
10 Views