Gradle
For greater customization, you can declare databases explicitly using the Gradle DSL.
build.gradle
:
sqldelight { // Database name MyDatabase { // Package name used for the generated MyDatabase.kt packageName = "com.example.db" // An array of folders where the plugin will read your '.sq' and '.sqm' // files. The folders are relative to the existing source set so if you // specify ["db"], the plugin will look into 'src/main/db'. // Defaults to ["sqldelight"] (src/main/sqldelight) sourceFolders = ["db"] // The directory where to store '.db' schema files relative to the root // of the project. These files are used to verify that migrations yield // a database with the latest schema. Defaults to null so the verification // tasks will not be created. schemaOutputDirectory = file("src/main/sqldelight/databases") // Optionally specify schema dependencies on other gradle projects dependency project(':OtherProject') // The dialect version you would like to target // Defaults to "sqlite:3.18" dialect = "sqlite:3.24" } }
If you're using Kotlin for your Gradle files:
build.gradle.kts
sqldelight { database("MyDatabase") { packageName = "com.example.db" sourceFolders = listOf("db") schemaOutputDirectory = file("build/dbs") dependency(project(":OtherProject")) dialect = "sqlite:3.24" } }