-
Notifications
You must be signed in to change notification settings - Fork 513
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Always create the database implementation (#3540)
Co-authored-by: hfhbd <hfhbd@users.noreply.github.com>
- Loading branch information
Showing
7 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
sqldelight-gradle-plugin/src/test/derive-schema-no-queries/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
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 { | ||
NoQueries { | ||
packageName = "app.cash.sqldelight.derive.schema.from.migrations.no.queries" | ||
deriveSchemaFromMigrations = true | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation libs.sqliteJdbc | ||
implementation "app.cash.sqldelight:sqlite-driver:${app.cash.sqldelight.VersionKt.VERSION}" | ||
implementation libs.truth | ||
} |
9 changes: 9 additions & 0 deletions
9
sqldelight-gradle-plugin/src/test/derive-schema-no-queries/settings.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apply from: "../settings.gradle" | ||
|
||
rootProject.name = 'derive-schema-no-queries' | ||
|
||
buildCache { | ||
local { | ||
directory = new File(rootDir, 'build-cache') | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
...le-plugin/src/test/derive-schema-no-queries/src/main/sqldelight/app/cash/sqldelight/1.sqm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
CREATE TABLE person ( | ||
_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, | ||
first_name TEXT NOT NULL, | ||
last_name TEXT NOT NULL | ||
); |
18 changes: 18 additions & 0 deletions
18
...erive-schema-no-queries/src/test/java/app/cash/sqldelight/integration/IntegrationTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package app.cash.sqldelight.integration | ||
|
||
import app.cash.sqldelight.derive.schema.from.migrations.no.queries.NoQueries | ||
import app.cash.sqldelight.driver.jdbc.sqlite.JdbcSqliteDriver | ||
import org.junit.After | ||
import org.junit.Test | ||
import java.io.File | ||
|
||
class IntegrationTests { | ||
@After fun after() { | ||
File("test.db").delete() | ||
} | ||
|
||
@Test fun `creating db works without query files`() { | ||
val database = JdbcSqliteDriver(JdbcSqliteDriver.IN_MEMORY) | ||
NoQueries.Schema.create(database) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters