SqlSchema

interface SqlSchema

API for creating and migrating a SQL database.

Functions

Link copied to clipboard
abstract fun create(driver: SqlDriver): QueryResult<Unit>

Use driver to create the schema from scratch. Assumes no existing database state.

Link copied to clipboard
abstract fun migrate(driver: SqlDriver, oldVersion: Int, newVersion: Int): QueryResult<Unit>

Use driver to migrate from schema oldVersion to newVersion.

Properties

Link copied to clipboard
abstract val version: Int

The version of this schema.

Extensions

Link copied to clipboard
fun SqlSchema.migrateWithCallbacks(driver: SqlDriver, oldVersion: Int, newVersion: Int, vararg callbacks: AfterVersion)

Run SqlSchema.migrate normally but execute callbacks during the migration whenever it finished upgrading to a version specified by AfterVersion.afterVersion.