You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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)
}
}
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.
The text was updated successfully, but these errors were encountered: