Hi,
After migrating from Exposed 0.17.3 to Exposed 0.22.1 we are facing an error when using SchemaUtil.createMissingTablesAndColumns with an H2 database on a table with primary key.
The eror produced is:
Syntax error in SQL statement "ALTER TABLE USERS MODIFY COLUMN ID VARCHAR(50) PRIMARY[*] KEY"
Checking the H2 documentation states that:
The options PRIMARY KEY, UNIQUE, and CHECK are not supported for ALTER statements
Which explains the error.
Did you find a solution, @supertote ?
The fun thing is, if you change the name of the table to anything different than Users or the "id" to "id2" it will work as expected.
Using h2 1.4.200 and exposed 0.25.1
This code will throw an exception.
```
object Users : Table() {
val id = integer("id") //change "id" to "id2" to pass the test :)
override val primaryKey = PrimaryKey(id)
}
@Test
fun h2UsersTableTest() {
Database.connect("jdbc:h2:mem:test", "org.h2.Driver")
transaction {
addLogger(StdOutSqlLogger)
create(Users)
createMissingTablesAndColumns(Users)
}
}
Sorry @hiperbou but I don't have a solution to this problem.
Fixed in #1051 (Released in Exposed 0.27.1)