How can you create a table that has two unique constraints? I've found this issue: <https://github.c...
m
How can you create a table that has two unique constraints? I've found this issue: https://github.com/JetBrains/Exposed/issues/239 And after updating the code to the newer Exposed version... it works on PostgreSQL (yay!) but it fails on SQLite with the following error:
Copy code
Exception in thread "main" org.jetbrains.exposed.exceptions.UnsupportedByDialectException: Auto-increment could be applied only to primary key column, dialect: sqlite.
Here's the table:
Copy code
object Abc : LongIdTable() {
    val user = long("user")
    val user2 = long("user2")

    override val primaryKey = PrimaryKey(id, user, user2)
}
So... is that an Exposed issue? Because I have no idea why it thinks it is a auto increment column. The only auto increment column is the "id" but it is also being included as a PrimaryKey
hmm, I think I understand why I didn't notice, but after including the "id" as the primary key, Exposed shown this error
Copy code
Auto-increment could be applied only to a single column primary key, dialect: sqlite.
So I guess it is impossible to do this in SQLite? Because auto-increment only works in a single column primary key (which I don't have, I have multiple primary keys)
a
Sqlite have hidden column with autoinc primary key, called RAWID
m
what I ended up doing was using H2 instead of SQLite ^-^