SupabaseForeignKeyConstraint class
Represents details about a specific foreign key constraint on a table.
A foreign key links a column (or a set of columns) in one table to a column (or a set of columns) in another table (or the same table). This enforces referential integrity.
Constructors
-
SupabaseForeignKeyConstraint.new({required String constraintName, required List<
String> columns, required List<String> originalColumns, List<String> ? localColumns, required String foreignTableSchema, required String foreignTableName, required String originalForeignTableName, String? localForeignTableName, required List<String> foreignColumns, required List<String> originalForeignColumns, List<String> ? localForeignColumns, required String updateRule, required String deleteRule, required String matchOption, required bool isDeferrable, required bool initiallyDeferred, String? joinTableName}) - Creates an instance of SupabaseForeignKeyConstraint.
-
SupabaseForeignKeyConstraint.fromJson(Map<
String, dynamic> json) -
Creates a SupabaseForeignKeyConstraint instance from a JSON map (deserialization).
Handles missing fields from older data formats with default values.
factory
Properties
-
columns
→ List<
String> -
List of local column names (converted to camelCase) that are part of this foreign key.
final
- constraintName → String
-
The original name of the foreign key constraint as defined in the database.
final
- deleteRule → String
-
The action to take on the referencing rows if the referenced row is deleted.
Common values:
NO ACTION
,CASCADE
,SET NULL
,SET DEFAULT
.final -
foreignColumns
→ List<
String> -
List of column names in the foreign table that this key references (converted to camelCase).
final
- foreignTableName → String
-
The name of the table referenced by this foreign key (converted to camelCase).
final
- foreignTableSchema → String
-
The schema of the table referenced by this foreign key.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- initiallyDeferred → bool
-
Indicates if the constraint check is deferred by default.
final
- isDeferrable → bool
-
Indicates if the constraint check can be deferred until the end of the transaction.
final
- joinTableName ↔ String?
-
If this foreign key is part of a many-to-many relationship, this holds the
name of the join table (intermediate table). Otherwise, it's
null
.getter/setter pair -
localColumns
→ List<
String> -
List of Dart-safe local column names.
If an original column name is a Dart keyword, this version will be suffixed.
final
-
localForeignColumns
→ List<
String> -
List of Dart-safe foreign column names.
final
- localForeignTableName → String
-
A Dart-safe class name for the foreign table.
If the original table name conflicts with a Dart built-in type, this will be suffixed.
final
- matchOption → String
-
The match type for the foreign key (e.g.,
SIMPLE
,FULL
,PARTIAL
). TypicallySIMPLE
for most use cases.final -
originalColumns
→ List<
String> -
List of original database names of the local columns for this foreign key.
final
-
originalForeignColumns
→ List<
String> -
List of original database names of the columns in the foreign table.
final
- originalForeignTableName → String
-
The original database name of the table referenced by this foreign key.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- updateRule → String
-
The action to take on the referencing rows if the referenced row is updated.
Common values:
NO ACTION
,CASCADE
,SET NULL
,SET DEFAULT
.final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sanitizedKey(
List< String> endings) → String - Generates a sanitized key for the foreign key relationship, used for generating field names in model classes.
-
toJson(
) → Map< String, dynamic> - Converts this SupabaseForeignKeyConstraint instance to a JSON map for serialization.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
fromRawRows(
String name, List< List> rows, String nameConverter(String), {String? joinTableName}) → SupabaseForeignKeyConstraint - Creates a SupabaseForeignKeyConstraint from a list of raw SQL query result rows.