<@U5NANKKA7>, documentation is a pain point of Exp...
# exposed
t
@ziad, documentation is a pain point of Exposed. insertIgnore works for tables with unique constraints and do insert only if there is no constraint error. If deviceId is a unique key in your case, then you can use insertIgnore, but I'm afraid it wont returns any keys. I don't like try-catch approach, so imo something like below is better:
Copy code
val userId = Users.select{
       Users.deviceId eq requestDeviceId
    }.map { it[Users.id] }?.singleOrNull() 
?: Users.insertAndGetId {
    it[deviceId] = requestDeviceId
}