cain.kim
07/02/2024, 2:32 PMcain.kim
07/02/2024, 2:44 PMSchemaUtils.statementsRequiredForDatabaseMigration
function and run them whenever there’s a change, and I’m going to run the statements I told you about in Flyway
cain.kim
07/02/2024, 2:50 PMfun main() {
Database.connect(
url = "jdbc:h2:mem:~",
driver = "org.h2.Driver",
)
transaction {
val statementsRequiredForDatabaseMigration =
SchemaUtils.statementsRequiredForDatabaseMigration(
UserEntity,
PostEntity,
)
println(statementsRequiredForDatabaseMigration.joinToString(separator = ";\n"))
}
}
like this….
and I’m going to make this function as a Gradle taskChantal Loncle
07/03/2024, 12:12 AMMigrationUtils.generateMigrationScript()
may also be of use to you. It is available in the new exposed-migration
module, which is available as of version 0.52.0.cain.kim
07/03/2024, 3:23 AM