From d763e8e6e180ac2e614d68b9021625d2ae4f74af Mon Sep 17 00:00:00 2001 From: Jocelyne <38375996+joc-a@users.noreply.github.com> Date: Tue, 7 Jan 2025 22:20:13 +0100 Subject: [PATCH] chore: Deprecate functions that should be replaced by migration functions (#2333) --- .../kotlin/org/jetbrains/exposed/sql/SchemaUtils.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/SchemaUtils.kt b/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/SchemaUtils.kt index 49333a0caa..5f9de60092 100644 --- a/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/SchemaUtils.kt +++ b/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/SchemaUtils.kt @@ -594,6 +594,12 @@ object SchemaUtils { * to use a lock based on synchronization with a dummy table. * @see SchemaUtils.withDataBaseLock */ + @Deprecated( + "Execution of this function might lead to unpredictable state in the database if a failure occurs at any point. " + + "To prevent this, please use `MigrationUtils.statementsRequiredForDatabaseMigration` with a third-party migration tool (e.g., Flyway).", + ReplaceWith("MigrationUtils.statementsRequiredForDatabaseMigration"), + DeprecationLevel.WARNING + ) fun createMissingTablesAndColumns(vararg tables: Table, inBatch: Boolean = false, withLogs: Boolean = true) { with(TransactionManager.current()) { db.dialect.resetCaches() @@ -637,6 +643,11 @@ object SchemaUtils { * By default, a description for each intermediate step, as well as its execution time, is logged at the INFO level. * This can be disabled by setting [withLogs] to `false`. */ + @Deprecated( + "This function will be removed in future releases.", + ReplaceWith("MigrationUtils.statementsRequiredForDatabaseMigration"), + DeprecationLevel.WARNING + ) fun statementsRequiredToActualizeScheme(vararg tables: Table, withLogs: Boolean = true): List { val (tablesToCreate, tablesToAlter) = tables.partition { !it.exists() } val createStatements = logTimeSpent("Preparing create tables statements", withLogs) {