SchemaUtils.createMissingTablesAndColumns raise NoSuchElementException
See original GitHub issueI deleted a field in MyFirstTableEntity then I try to restart the server and this exception appears
Code:
val allTables = listOf(
MyFirstTableEntity,
MySecondTableEntity
)
transaction(db) {
SchemaUtils.createMissingTablesAndColumns(*allTables.toTypedArray())
}
Stacktrace:
java.util.NoSuchElementException: Key MY_FIRST_TABLE_ENTITY_COPY_4_0 is missing in the map.
at kotlin.collections.MapsKt__MapWithDefaultKt.getOrImplicitDefaultNullable(MapWithDefault.kt:24)
at kotlin.collections.MapsKt__MapsKt.getValue(Maps.kt:348)
at org.jetbrains.exposed.sql.statements.jdbc.JdbcDatabaseMetadataImpl$tableConstraints$1$1.invoke(JdbcDatabaseMetadataImpl.kt:232)
at org.jetbrains.exposed.sql.statements.jdbc.JdbcDatabaseMetadataImpl$tableConstraints$1$1.invoke(JdbcDatabaseMetadataImpl.kt:221)
at org.jetbrains.exposed.sql.statements.jdbc.JdbcDatabaseMetadataImplKt.iterate(JdbcDatabaseMetadataImpl.kt:267)
at org.jetbrains.exposed.sql.statements.jdbc.JdbcDatabaseMetadataImplKt.access$iterate(JdbcDatabaseMetadataImpl.kt:1)
at org.jetbrains.exposed.sql.statements.jdbc.JdbcDatabaseMetadataImpl.tableConstraints(JdbcDatabaseMetadataImpl.kt:221)
at org.jetbrains.exposed.sql.vendors.VendorDialect$fillConstraintCacheForTables$1.invoke(Default.kt:740)
at org.jetbrains.exposed.sql.vendors.VendorDialect$fillConstraintCacheForTables$1.invoke(Default.kt:740)
at org.jetbrains.exposed.sql.statements.jdbc.JdbcConnectionImpl.metadata(JdbcConnectionImpl.kt:63)
at org.jetbrains.exposed.sql.Database.metadata$exposed_core(Database.kt:39)
at org.jetbrains.exposed.sql.vendors.VendorDialect.fillConstraintCacheForTables(Default.kt:740)
at org.jetbrains.exposed.sql.vendors.VendorDialect.columnConstraints(Default.kt:718)
at org.jetbrains.exposed.sql.SchemaUtils.addMissingColumnsStatements(SchemaUtils.kt:223)
at org.jetbrains.exposed.sql.SchemaUtils.createMissingTablesAndColumns(SchemaUtils.kt:318)
at org.jetbrains.exposed.sql.SchemaUtils.createMissingTablesAndColumns$default(SchemaUtils.kt:306)
.... my application calls here
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
0 - Stack Overflow
I'm using 0.22.1 Exposed libs (core/dao/jdbc) and when I use "SchemaUtils.createMissingTablesAndColumns", my tables are created but I get an ...
Read more >[Bug] Regression in 0.22.1, createMissingTablesAndColumns ...
The code below works with exposed 0.21.1, but fails with 0.22.1. package org.user5145.champion.integration import com.zaxxer.hikari.
Read more >JetBrains - Bountysource
I want to get the raw SQL query string that the database query builder above will generate. In this example, it would be...
Read more >Kotlin Exposed - A lightweight SQL library - JDriven Blog
Kotlin Exposed provides a class SchemaUtils to create, drop, update tables ... createMissingTablesAndColumns(Actors, Movies, ActorsInMovies) ...
Read more >Flutter-based mobile app displaying a list of daily curated ...
... b4cde5b Allow defining tables with quoted names (#1562); 070bff8 SchemaUtils.createMissingTablesAndColumns raise NoSuchElementException ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Should be solved in the next release
Looks like the problem is that Exposed located foreign key and can’t find corresponding column in mapping. I’ll take a look how it can be solved.