Instance Method
foreignKey(_:references:_:onDelete:onUpdate:named:)
Add a
FOREIGN KEY constraint to the table.@discardableResult func foreignKey(_ columns: [String], references foreignTable: String, _ foreignColumns: [String], onDelete: SQLForeignKeyAction? = nil, onUpdate: SQLForeignKeyAction? = nil, named constraintName: String? = nil) -> Self
Parameters
columnsOne or more columns to include in the constraint.
foreignTableThe table referenced by the constraint.
foreignColumnsThe foreign table columns corresponding to the constrained columns.
onDeleteOptional foreign key action to perform on delete.
onUpdateOptional foreign key action to perform on update.
constraintNameAn optional name to give the constraint.