Foreign Key Constraint
interface ForeignKeyConstraint
Represents a FOREIGN KEY in a KQLiteTable.
This interface provides a fluent API to build a complete foreign key definition, including specifying the referenced parent table columns and defining actions for ForeignKeyConstraint.onDelete and ForeignKeyConstraint.onUpdate.
Example
// Inside KQLiteTable
override val constraints: (ConstraintBuilder.() -> Unit)? = {
foreignKey(columnA, columnB)
.references(ParentTable.columnX, ParentTable.columnY)
.onDelete(ForeignKeyAction.CASCADE)
.onUpdate(ForeignKeyAction.NO_ACTION)
.deferrable(true)
.initially(Initially.DEFERRED)
}Content copied to clipboard
Author
MOHAMMAD AZIM ANSARI
See also
Functions
Link copied to clipboard
Same as calling deferrable(allow = true)
This corresponds to the DEFERRABLE clause in a FOREIGN KEY definition.
Link copied to clipboard
This corresponds to the INITIALLY clause in a FOREIGN KEY definition.
Link copied to clipboard
This corresponds to the ON DELETE clause in a FOREIGN KEY definition.
Link copied to clipboard
This corresponds to the ON UPDATE clause in a FOREIGN KEY definition.
Link copied to clipboard
This corresponds to the REFERENCES clause in a FOREIGN KEY definition.