SupabaseTableInfo class
Represents detailed information about a database table, including its columns, foreign keys, indexes, and reverse relationships.
This class is a central piece of metadata used for code generation, allowing the creation of Dart model classes that accurately reflect the database schema.
Constructors
-
SupabaseTableInfo.new({required String name, required String originalName, String? localName, required String schema, required List<
TetherColumnInfo> columns, required List<SupabaseForeignKeyConstraint> foreignKeys, required List<SupabaseIndexInfo> indexes, String? comment, List<ModelReverseRelationInfo> reverseRelations = const []}) - Creates an instance of SupabaseTableInfo.
-
SupabaseTableInfo.fromJson(Map<
String, dynamic> json) -
Creates a SupabaseTableInfo instance from a JSON map (deserialization).
Handles missing fields from older data formats with default values.
factory
Properties
-
columns
→ List<
TetherColumnInfo> -
A list of TetherColumnInfo objects representing the columns in this table.
final
- comment → String?
-
The comment associated with the table in the database, if any.
final
-
foreignKeys
→ List<
SupabaseForeignKeyConstraint> -
A list of SupabaseForeignKeyConstraint objects representing the foreign keys
defined on this table.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
indexes
→ List<
SupabaseIndexInfo> -
A list of SupabaseIndexInfo objects representing the indexes on this table.
final
- localName → String
-
A Dart-safe class name for the table.
If
originalName
conflicts with a Dart built-in type (e.g.,List
),localName
might beListTable
.final - name → String
-
The name of the table, converted to camelCase for Dart conventions.
Example:
user_profiles
becomesuserProfiles
.final - originalName → String
-
The original database name of the table.
Example:
user_profiles
.final -
primaryKeys
→ List<
TetherColumnInfo> -
Gets a list of columns that are part of the primary key for this table.
no setter
-
reverseRelations
→ List<
ModelReverseRelationInfo> -
A list of ModelReverseRelationInfo objects describing relationships where
other tables reference this table (one-to-many or through a join table).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- schema → String
-
The database schema the table belongs to (e.g.,
public
).final - uniqueKey → String
-
A unique key for this table, combining schema and original name.
Example:
public.user_profiles
.no setter
Methods
-
getForeignKeyByName(
String constraintName) → SupabaseForeignKeyConstraint? -
Finds a foreign key constraint by its
constraintName
. Returnsnull
if no such constraint exists. -
getForeignKeysForColumn(
String columnName) → List< SupabaseForeignKeyConstraint> -
Gets a list of foreign key constraints that involve the specified
columnName
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sanitizedKeys(
List< String> endings) → Map<String, SupabaseForeignKeyConstraint> - Returns a map of sanitized keys for all foreign key relationships of this table.
-
toJson(
) → Map< String, dynamic> - Converts this SupabaseTableInfo 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