Foreign class
Annotation used to mark a field as a foreign key.
Allows for specifying how the foreign key relationship should behave when the referenced data is updated or deleted in the parent table.
Example:
@Foreign(
'posts', // References the 'posts' table.
'post_id', // The referenced column is 'post_id'.
onDelete: Operation.setNull, // On delete, set the foreign key column to null.
onUpdate: Operation.restrict, // On update, restrict changes.
)
final int postId;
Constructors
Properties
- column → String?
-
The column in the referenced table to match. If null, the annotated field name will be used.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- onDelete → Operation
-
Defines the action to take when the referenced row is deleted. Defaults to
CASCADE.final - onUpdate → Operation
-
Defines the action to take when the referenced row is updated. Defaults to
CASCADE.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- table → String
-
The name of the table that this field references.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited