Back to Exposed

MigrationUtils

docs/api/exposed-migration-jdbc/org.jetbrains.exposed.v1.migration.jdbc/-migration-utils/index.html

1.2.04.0 KB
Original Source

MigrationUtils

object MigrationUtils : MigrationUtilityApi

Utility functions that assist with generating the necessary SQL statements to migrate database schema objects.

Members

Functions

dropUnmappedColumnsStatements

Link copied to clipboard

fun dropUnmappedColumnsStatements(vararg tables: Table, withLogs: Boolean = true): List<String>

Returns the SQL statements that drop any columns that exist in the database but are not defined in tables.

dropUnmappedIndices

Link copied to clipboard

fun dropUnmappedIndices(vararg tables: Table, withLogs: Boolean = true): List<String>

Returns the SQL statements that drop any indices that exist in the database but are not defined in tables.

dropUnmappedSequences

Link copied to clipboard

fun dropUnmappedSequences(vararg tables: Table, withLogs: Boolean = true): List<String>

Returns the SQL statements that drop any sequences that exist in the database but are not defined in tables.

generateMigrationScript

Link copied to clipboard

fun generateMigrationScript(vararg tables: Table, scriptDirectory: String, scriptName: String, withLogs: Boolean = true): File

This function simply generates the migration script without applying the migration. Its purpose is to show what the migration script will look like before applying the migration. If a migration script with the same name already exists, its content will be overwritten.

statementsRequiredForDatabaseMigration

Link copied to clipboard

fun statementsRequiredForDatabaseMigration(vararg tables: Table, withLogs: Boolean = true): List<String>

Returns the SQL statements that need to be executed to make the existing database schema compatible with the table objects defined using Exposed. Unlike SchemaUtils.statementsRequiredToActualizeScheme(), DROP/DELETE statements are included.

Generated by Dokka © 2026 Copyright