hasColumns method

  1. @override
Future<bool> hasColumns(
  1. String table,
  2. List<String> columns, {
  3. String? schema,
})
override

Determines if the given table has all of the specified columns.

Implementation

@override
Future<bool> hasColumns(
  String table,
  List<String> columns, {
  String? schema,
}) async {
  final tableColumns = snapshot.columns
      .where(
        (c) => _equalsOwner(c.schema, schema) && _equals(c.tableName, table),
      )
      .toList();

  for (final column in columns) {
    if (!tableColumns.any((c) => _equals(c.name, column))) {
      return false;
    }
  }

  return true;
}