listTables method

  1. @override
Future<List<String>> listTables()
override

List the database tables names.

Implementation

@override
Future<List<String>> listTables() async {
  var sqlAdapter = this.sqlAdapter!;

  var allRepositories = sqlAdapter.allRepositories().values.toList();

  var tables = allRepositories.map((e) => e.name).toList();

  var tablesSchemes = await tables
      .map((t) => sqlAdapter.getTableScheme(t))
      .toList()
      .resolveAll();

  var relationshipTables = tablesSchemes.nonNulls
      .expand((e) => e.tableRelationshipReference.values.expand((e) => e));

  var allTables = [
    ...tables,
    ...relationshipTables.map((e) => e.relationshipTable)
  ];

  return allTables;
}