TableSchema class final

Immutable physical table metadata, independent of Dart model identity.

The constructor copies collection inputs, including nested key and index column lists. Schema consumers validate engine support before executing DDL.

final accounts = TableSchema(
  'accounts',
  columns: [Column('id', Codecs.integer), Column('email', Codecs.text)],
  primaryKey: ['id'],
  uniqueKeys: [['email']],
);

Constructors

TableSchema(String name, {required List<Column<Object?>> columns, List<String> primaryKey = const [], List<List<String>> uniqueKeys = const [], List<ForeignKey> foreignKeys = const [], List<IndexSchema> indexes = const [], List<CheckSchema> checks = const []})
Copies schema collections without opening or altering a database.

Properties

checks List<CheckSchema>
Database CHECK constraints expressed in trusted SQL.
final
clientDefaults List<Column<Object?>>
Columns with Dart insert factories, derived from columns.
final
columns List<Column<Object?>>
Ordered columns used to render the physical schema.
final
foreignKeys List<ForeignKey>
Database-enforced references to keys in other physical tables.
final
hashCode int
The hash code for this object.
no setterinherited
indexes List<IndexSchema>
Explicit indexes; foreign keys do not imply extra indexes here.
final
name String
Physical table name.
final
primaryKey List<String>
Ordered primary-key column names, or an empty list when absent.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
uniqueKeys List<List<String>>
Ordered column groups with database uniqueness constraints.
final

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