ForeignKey constructor

ForeignKey({
  1. required String name,
  2. required String refTable,
  3. String refColumn = 'id',
  4. String onDelete = 'NO ACTION',
  5. String onUpdate = 'NO ACTION',
})

Creates a foreign key constraint.

name is the field name in the current table (required) refTable is the referenced table name (required) refColumn is the referenced column name (default: 'id') onDelete specifies the action on delete (default: 'NO ACTION') Common values: 'CASCADE', 'SET NULL', 'RESTRICT', 'NO ACTION' onUpdate specifies the action on update (default: 'NO ACTION') Common values: 'CASCADE', 'SET NULL', 'RESTRICT', 'NO ACTION'

Implementation

ForeignKey({
  required this.name,
  required this.refTable,
  this.refColumn = 'id',
  this.onDelete = 'NO ACTION',
  this.onUpdate = 'NO ACTION',
});