TableSchema class final

Immutable physical table metadata, independent of Dart model identity.

The constructor copies collection inputs, including nested key and index column lists, and rejects empty table/schema names and names containing dots or NUL, including foreign-key targets. 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, {String? namespace, 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
identity → String
Stable physical identity for maps and diagnostics, never parsed as SQL.
no setter
indexes → List<IndexSchema>
Explicit indexes; foreign keys do not imply extra indexes here.
final
name → String
Non-empty physical table name, without a schema prefix, dots or NUL.
final
namespace → String?
PostgreSQL namespace. Generated PostgreSQL models always specify this, including public; other engines reject explicit namespaces. Null also preserves the meaning and fingerprints of historical metadata.
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