hasColumn method

Future<bool> hasColumn(
  1. String table,
  2. String column
)

Checks if a column exists on a table.

Implementation

Future<bool> hasColumn(String table, String column) async {
  final result = await _db.query(
    'SELECT EXISTS (SELECT FROM information_schema.columns WHERE table_name = @table AND column_name = @column)',
    {'table': table, 'column': column},
  );
  return result.rows.first['exists'] == true;
}