Skip to content
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

Fix failing sqlite VerifyMigrationTask with Hsql #3380

Merged
merged 1 commit into from Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -113,6 +113,7 @@ abstract class VerifyMigrationTask : SqlDelightWorkerTask() {
}

override fun execute() {
if (!environment.dialect.isSqlite) return
parameters.workingDirectory.get().asFile.deleteRecursively()

val catalog = createCurrentDb()
Expand Down
Expand Up @@ -27,6 +27,15 @@ class MigrationTest {
assertThat(output.output).contains("BUILD SUCCESSFUL")
}

@Test fun `verification disabled succeeds with hsql dialect`() {
val output = GradleRunner.create()
.withCommonConfiguration(File("src/test/verify-migration-disabled-no-errors"))
.withArguments("clean", "verifyMainDatabaseMigration", "--stacktrace")
.build()

assertThat(output.output).contains("BUILD SUCCESSFUL")
}

@Test fun `failing migration errors properly`() {
val output = GradleRunner.create()
.withCommonConfiguration(File("src/test/migration-failure"))
Expand Down
@@ -0,0 +1,21 @@
buildscript {
apply from: "${projectDir.absolutePath}/../buildscript.gradle"
}

apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'app.cash.sqldelight'

repositories {
maven {
url "file://${projectDir.absolutePath}/../../../../build/localMaven"
}
mavenCentral()
}

sqldelight {
Database {
packageName = "com.example"
dialect("app.cash.sqldelight:hsql-dialect:${app.cash.sqldelight.VersionKt.VERSION}")
verifyMigrations = false
}
}
@@ -0,0 +1,3 @@
apply from: "../settings.gradle"

rootProject.name = 'sqldelight-migrations'
@@ -0,0 +1,3 @@
CREATE TABLE foo(
bar BIGINT PRIMARY KEY AUTO_INCREMENT GENERATED ALWAYS AS IDENTITY
);