table method

PostgresTableHandle table(
  1. String name, {
  2. required Map<String, PostgresTableField> fields,
  3. String? description,
  4. bool isView = false,
})

Declares one shared SQL table for either Supabase or generic Postgres.

Exactly one SQL backend config must already be active through supabase or postgres.

Implementation

PostgresTableHandle table(
  String name, {
  required Map<String, PostgresTableField> fields,
  String? description,
  bool isView = false,
}) {
  _ensureSqlBackendConfigured('table');
  _ensureNotPendingRemoval(_pendingRemovals, name, 'table', 'removeTable');
  _ensureUnique(_tableNames, name, 'table');
  final handle = PostgresTableHandle(
    name,
    fields,
    description: description ?? 'DSL table $name',
    isView: isView,
  );
  _tables.add(
    PostgresTableDeclaration(
      handle: handle,
      description: description ?? 'DSL table $name',
    ),
  );
  return handle;
}