findTableNamed method
Finds a table by its name, or returns null if no table with the given name.
A schema of public is the unspecified default and falls back to
matching on name alone.
Implementation
TableDefinition? findTableNamed(String tableName, {String? schema}) {
var candidates = tables.where((table) => table.name == tableName);
if (schema == null) return candidates.firstOrNull;
return candidates.singleWhereOrNull((table) => table.schema == schema) ??
(schema == 'public' ? candidates.firstOrNull : null);
}