Skip to content

Commit

Permalink
Upgrading SQLDelight
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanfallet committed Jan 14, 2024
1 parent feb5f26 commit 846ba04
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 21 deletions.
9 changes: 1 addition & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ plugins {
id("org.jetbrains.kotlinx.kover").version("0.7.4")
id("com.google.devtools.ksp").version("1.9.20-1.0.13").apply(false)
id("org.jetbrains.compose").version("1.5.10").apply(false)
id("app.cash.sqldelight").version("2.0.0").apply(false)
id("com.rickclephas.kmp.nativecoroutines").version("1.0.0-ALPHA-19").apply(false)
}

Expand All @@ -19,14 +20,6 @@ allprojects {
}
}

buildscript {
val sqlDelightVersion = "1.5.3"

dependencies {
classpath("com.squareup.sqldelight:gradle-plugin:$sqlDelightVersion")
}
}

tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
}
16 changes: 9 additions & 7 deletions shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
kotlin("plugin.serialization")
id("org.jetbrains.kotlinx.kover")
id("com.google.devtools.ksp")
id("com.squareup.sqldelight")
id("app.cash.sqldelight")
id("com.rickclephas.kmp.nativecoroutines")
}

Expand All @@ -25,7 +25,7 @@ kotlin {
val coroutinesVersion = "1.7.3"
val ktorVersion = "2.3.7"
val koinVersion = "3.5.3"
val sqlDelightVersion = "1.5.3"
val sqlDelightVersion = "2.0.0"

sourceSets {
all {
Expand All @@ -44,7 +44,7 @@ kotlin {
implementation("io.insert-koin:koin-core:$koinVersion")
implementation("io.sentry:sentry-kotlin-multiplatform:0.2.1")

implementation("com.squareup.sqldelight:runtime:$sqlDelightVersion")
implementation("app.cash.sqldelight:runtime:$sqlDelightVersion")

api("com.rickclephas.kmm:kmm-viewmodel-core:1.0.0-ALPHA-16")
api("org.jetbrains.kotlinx:kotlinx-datetime:0.5.0")
Expand All @@ -56,7 +56,7 @@ kotlin {
val androidMain by getting {
dependencies {
implementation("io.ktor:ktor-client-android:$ktorVersion")
implementation("com.squareup.sqldelight:android-driver:$sqlDelightVersion")
implementation("app.cash.sqldelight:android-driver:$sqlDelightVersion")
}
}
val androidUnitTest by getting {
Expand All @@ -75,7 +75,7 @@ kotlin {
iosSimulatorArm64Main.dependsOn(this)
dependencies {
implementation("io.ktor:ktor-client-darwin:$ktorVersion")
implementation("com.squareup.sqldelight:native-driver:$sqlDelightVersion")
implementation("app.cash.sqldelight:native-driver:$sqlDelightVersion")
}
}
val iosX64Test by getting
Expand Down Expand Up @@ -109,7 +109,9 @@ koverReport {
}

sqldelight {
database("AppDatabase") {
packageName = "me.nathanfallet.extopy.database"
databases {
create("AppDatabase") {
packageName.set("me.nathanfallet.extopy.database")
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package me.nathanfallet.extopy.database

import android.content.Context
import com.squareup.sqldelight.android.AndroidSqliteDriver
import com.squareup.sqldelight.db.SqlDriver
import app.cash.sqldelight.db.SqlDriver
import app.cash.sqldelight.driver.android.AndroidSqliteDriver

actual class DatabaseDriverFactory(private val context: Context) {
actual fun createDriver(): SqlDriver {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ package me.nathanfallet.extopy.database
class Database(databaseDriverFactory: DatabaseDriverFactory) {

private val database = AppDatabase(databaseDriverFactory.createDriver())
private val dbQuery = database.appDatabaseQueries
//private val dbQuery = database.appDatabaseQueries

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package me.nathanfallet.extopy.database

import com.squareup.sqldelight.db.SqlDriver
import app.cash.sqldelight.db.SqlDriver

expect class DatabaseDriverFactory {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package me.nathanfallet.extopy.database

import com.squareup.sqldelight.db.SqlDriver
import com.squareup.sqldelight.drivers.native.NativeSqliteDriver
import app.cash.sqldelight.db.SqlDriver
import app.cash.sqldelight.driver.native.NativeSqliteDriver

actual class DatabaseDriverFactory {

Expand Down

0 comments on commit 846ba04

Please sign in to comment.