hasTable method

bool hasTable(
  1. String table, {
  2. String? schema,
})

Returns true if a table exists within the captured snapshot.

Implementation

bool hasTable(String table, {String? schema}) {
  final snapshot = _requireSnapshot();
  final target = _applyTablePrefix(table, schema: schema).toLowerCase();
  final schemaTarget = schema?.toLowerCase();
  return snapshot.tables.any((entry) {
    final entrySchema = entry.schema?.toLowerCase();
    if (schemaTarget != null && entrySchema != schemaTarget) {
      return false;
    }
    return entry.name.toLowerCase() == target;
  });
}