getEntityColumnsName<T> method

Future<List<String>> getEntityColumnsName<T>()

Returns the list of column names of the entity table T as currently stored in SQLite. Useful to detect schema drift (columns added or removed on the Dart side).

Implementation

Future<List<String>> getEntityColumnsName<T>() async {
  final List<Map<String, Object?>> rows = await (await _executor()).select(
    'PRAGMA table_info(${quoteAlways(_tableFor<T>())})',
  );
  return rows
      .map((Map<String, Object?> row) => row['name']! as String)
      .toList();
}