ForeignKeyDefinition class final

A foreign key constraint.

Constructors

ForeignKeyDefinition(List<String> columns, {String? name})
A foreign key on columns; created by Blueprint.foreign and ForeignIdDefinition.constrained.

Properties

columns → List<String>
The local columns of the key.
final
hashCode → int
The hash code for this object.
no setterinherited
onDeleteAction ↔ String?
The ON DELETE action (onDelete), upper case.
getter/setter pair
onUpdateAction ↔ String?
The ON UPDATE action (onUpdate), upper case.
getter/setter pair
referencedColumns ↔ List<String>
The columns it references in referencedTable (id by default).
getter/setter pair
referencedTable ↔ String?
The table it references (on).
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

cascadeOnDelete() → ForeignKeyDefinition
Deletes the rows when the referenced row is deleted.
cascadeOnUpdate() → ForeignKeyDefinition
Updates the column when the referenced key changes.
nameFor(String table) → String
Constraint name (<table>_<columns>_foreign when unset).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
nullOnDelete() → ForeignKeyDefinition
Sets the column to NULL when the referenced row is deleted.
on(String table) → ForeignKeyDefinition
The referenced table (->on('users')).
onDelete(String action) → ForeignKeyDefinition
The action when the referenced row is deleted: cascade, restrict, set null or no action.
onUpdate(String action) → ForeignKeyDefinition
The action when the referenced key changes.
references(Object column) → ForeignKeyDefinition
The referenced column, or a list of columns (->references('id')).
restrictOnDelete() → ForeignKeyDefinition
Refuses to delete a referenced row while rows point at it.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited