From 338926aa20b47d3ad9b8b29ca34c89e51fd5677a Mon Sep 17 00:00:00 2001 From: devgor88 Date: Sat, 7 Dec 2024 11:37:52 +0300 Subject: [PATCH] fix: add mariadb one more case to DatabaseMigrationTests --- .../sql/tests/shared/ddl/DatabaseMigrationTests.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/ddl/DatabaseMigrationTests.kt b/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/ddl/DatabaseMigrationTests.kt index b8fac58c78..c47db4866d 100644 --- a/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/ddl/DatabaseMigrationTests.kt +++ b/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/ddl/DatabaseMigrationTests.kt @@ -432,6 +432,16 @@ class DatabaseMigrationTests : DatabaseTestsBase() { withDb(excludeSettings = listOf(TestDB.SQLITE)) { testDb -> if (currentDialectTest.supportsCreateSequence) { try { + // MariaDB does not allow to create auto column without defining it as a key + val tableWithAutoIncrement = if (testDb == TestDB.MARIADB) { + object : IdTable("test_table") { + override val id: Column> = long("id").autoIncrement().entityId() + override val primaryKey = PrimaryKey(id) + } + } else { + tableWithAutoIncrement + } + SchemaUtils.create(tableWithAutoIncrement) assertEquals(0, MigrationUtils.statementsRequiredForDatabaseMigration(tableWithAutoIncrement, withLogs = false).size)