38 lines
702 B
Markdown
38 lines
702 B
Markdown
# migration-kt
|
|
|
|
`migration-kt` is a Kotlin library that enables code-based migrations.
|
|
|
|
## Installation
|
|
|
|
Add the following to your `build.gradle.kts`.
|
|
|
|
```kotlin
|
|
repositories {
|
|
maven("https://git.infendro.com/api/packages/Infendro/maven")
|
|
}
|
|
|
|
dependencies {
|
|
implementation("com.infendro:migration:1.1.1")
|
|
}
|
|
```
|
|
|
|
## Usage
|
|
|
|
```kotlin
|
|
import com.infendro.migration.migrate
|
|
import org.jetbrains.exposed.sql.Database
|
|
|
|
fun configureDatabase() {
|
|
// connect to a database
|
|
Database.connect(/* parameters */)
|
|
|
|
// declare and execute migrations
|
|
migrate {
|
|
// create a migration
|
|
migration("initial") {
|
|
// execute code to migrate the database
|
|
}
|
|
}
|
|
}
|
|
```
|