ForeignKeyAction enum

Constants definition for values that can be used in ForeignKey.onDelete and ForeignKey.onUpdate

Inheritance

Constructors

ForeignKeyAction()
const

Values

noAction → const ForeignKeyAction

Possible value for ForeignKey.onDelete or ForeignKey.onUpdate.

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

Possible value for ForeignKey.onDelete or ForeignKey.onUpdate.

The RESTRICT action means that the application is prohibited from deleting (for ForeignKey.onDelete) or modifying (for ForeignKey.onUpdate) 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.

setNull → const ForeignKeyAction

Possible value for ForeignKey.onDelete or ForeignKey.onUpdate.

If the configured action is 'SET NULL', then when a parent key is deleted (for ForeignKey.onDelete) or modified (for ForeignKey.onUpdate), the child key columns of all rows in the child table that mapped to the parent key are set to contain NULL values.

setDefault → const ForeignKeyAction

Possible value for ForeignKey.onDelete or ForeignKey.onUpdate.

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

Possible value for ForeignKey.onDelete or ForeignKey.onUpdate.

A 'CASCADE' action propagates the delete or update operation on the parent key to each dependent child key. For ForeignKey.onDelete action, this means that each row in the child entity that was associated with the deleted parent row is also deleted. For an ForeignKey.onUpdate action, it means that the values stored in each dependent child key are modified to match the new parent key values.

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

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.