Migration tool for Kotlin.
import com.lavans.kotmi.Kotmi.Migration
...
DataSource.connect()
// Make some migration functions with version id.
val m1 = Migration("0.0.1", {
SchemaUtils.create(MigrationTestTable)
SchemaUtils.createIndex(arrayOf(MigrationTestTable.id), true)
})
val m2 = Migration("0.0.2", {
SchemaUtils.createIndex(arrayOf(MigrationTestTable.value), true)
})
// Call 'Kotmi.migrate()' with module id
Kotmi.migrate("module_id", m1, m2)
// That's all ;)
Executable sample. KotmiTest.kt
This project is not deployed to maven central yet.
$ git clone https://github.com/dobashi/kotmi.git
$ cd kotmi
$ ./gradlew install
Add dependency to your project.
gradle Kotlin DSL sample
dependencies {
compile("com.lavans.kotmi:kotmi:1.0")
}
Make database.json with your database configuration.
{
"url": "jdbc:h2:mem:regular",
"driver": "org.h2.Driver",
"user":"user",
"pass":"pass"
}
- Configure version management table name.
- Configure logging level.
- Without DatabaseConfig/ConnectionPool version.
- Test for Android(with SQLite)
kotomi_management_versions
No. Please make reverse migration for downgrading. You already know that git doesn't delete any commit on reverting.
No. Kotmi support only ()->Unit
funciton. KotmiTest uses Exposed to migrate Database schema.