create Index
Creates all defined indexes for a given table.
This function iterates through the index definitions associated with the provided KQLiteTable object and executes CREATE INDEX SQL statements for each one. Indexes are typically defined within the table's init block or a similar setup using the index() or uniqueIndex() functions.
This method is automatically called by createTable, so it's usually not necessary to call it directly unless you are managing indexes separately from table creation.
Example
object UserTable : KQLiteTable("users") {
val id = integerColumn("id").primaryKey()
val name = textColumn("name")
val city = textColumn("city")
override val indexes: (IndexBuilder.() -> Unit)?
get() = {
createIndex("idx_name_city").on(name, city)
}
}
// When schema.createTable(UserTable) is called, it will internally call
// createIndex(UserTable), which executes:
// CREATE INDEX "idx_user_name_city" ON "users" ("name", "city");Author
MOHAMMAD AZIM ANSARI
Parameters
The KQLiteTable for which the indexes should be created. The function will look up the index definitions on this object.
See also
Throws
if an error occurs during index creation, such as a syntax error, an invalid column name, or if an index with the same name already exists.