# exposed


09/12/2021, 3:37 AM
How can you create a table that has two unique constraints? I've found this issue: 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" 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)


09/12/2021, 10:54 AM
Sqlite have hidden column with autoinc primary key, called RAWID


09/12/2021, 1:31 PM
what I ended up doing was using H2 instead of SQLite ^-^