unique
Adds a UNIQUE constraint to this column.
This constraint ensures that all values in the column are distinct from one another. An attempt to insert a duplicate value will result in an error, unless an ON CONFLICT clause is specified.
For creating a UNIQUE constraint across multiple columns (a composite unique key), use the unique() function within the constraints block of the table definition.
Example:
object Users : KQLiteTable("users") {
val id = longColumn("id").primaryKey()
// Ensures that every user has a unique email address.
val email = stringColumn("email").notNull().unique()
}Content copied to clipboard
Return
The same KQLiteColumn instance, now marked as unique, to allow for further chaining of constraints.
Author
MOHAMMAD AZIM ANSARI