ForeignKeyAction enum
Actions to take when the parent Entity is deleted/updated from/in the database.
- Inheritance
- Available extensions
Values
- NO_ACTION → const ForeignKeyAction
-
When a parent key is modified or deleted from the database, no special action is taken. This means that SQLite will not make any effort to fix the constraint failure, instead, reject the change.
- RESTRICT → const ForeignKeyAction
-
The RESTRICT action means that the application is prohibited from deleting (for
onDelete
) or modifying (foronUpdate
) a parent key when there exists one or more child keys mapped to it. The difference between the effect of a RESTRICT action and normal foreign key constraint enforcement is that the RESTRICT action processing happens as soon as the field is updated - not at the end of the current statement as it would with an immediate constraint, or at the end of the current transaction as it would with a deferred constraint. Even if the foreign key constraint it is attached to is deferred, configuring a RESTRICT action causes SQLite to return an error immediately if a parent key with dependent child keys is deleted or modified. - SET_NULL → const ForeignKeyAction
-
If the configured action is SET_NULL, then when a parent key is deleted (for
onDelete
) or modified (foronUpdate
), the child key columns of all rows in the child table that mapped to the parent key are set to containNULL
values. - SET_DEFAULT → const ForeignKeyAction
-
The SET_DEFAULT actions are similar to SET_NULL, except that each of the child key columns is set to contain the columns default value instead of NULL
- CASCADE → const ForeignKeyAction
-
A CASCADE action propagates the delete or update operation on the parent key to each dependent child key. For
onDelete
action, this means that each row in the child entity that was associated with the deleted parent row is also deleted. For an onUpdate action, it means that the values stored in each dependent child key are modified to match the new parent key values.
Properties
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
Constants
-
values
→ const List<
ForeignKeyAction> - A constant List of the values in this enum, in order of their declaration.