diff --git a/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/ddl/CreateMissingTablesAndColumnsTests.kt b/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/ddl/CreateMissingTablesAndColumnsTests.kt index e2d041fa0f..3f18da634b 100644 --- a/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/ddl/CreateMissingTablesAndColumnsTests.kt +++ b/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/ddl/CreateMissingTablesAndColumnsTests.kt @@ -645,4 +645,20 @@ class CreateMissingTablesAndColumnsTests : DatabaseTestsBase() { } } } + + @Test + fun testCreateCompositePrimaryKeyTableAndCompositeForeignKeyInVariousOrder() { + withTables(CompositeForeignKeyTable, CompositePrimaryKeyTable) { + SchemaUtils.createMissingTablesAndColumns(CompositePrimaryKeyTable, CompositeForeignKeyTable) + } + withTables(CompositeForeignKeyTable, CompositePrimaryKeyTable) { + SchemaUtils.createMissingTablesAndColumns(CompositeForeignKeyTable, CompositePrimaryKeyTable) + } + withTables(CompositePrimaryKeyTable, CompositeForeignKeyTable) { + SchemaUtils.createMissingTablesAndColumns(CompositePrimaryKeyTable, CompositeForeignKeyTable) + } + withTables(CompositePrimaryKeyTable, CompositeForeignKeyTable) { + SchemaUtils.createMissingTablesAndColumns(CompositeForeignKeyTable, CompositePrimaryKeyTable) + } + } }