clean method
Implementation
Future<void> clean() async {
_logger.warning('Clearing database.');
final tableNames = tables._allTables.expand((e) => e.tables);
final typeNames = tables._allTables.expand((e) => e.types);
await run((connection) async {
final tables = tableNames.join(', ');
final result =
await connection.execute('DROP TABLE IF EXISTS $tables CASCADE');
_logger.fine('Dropped $tables ($result)');
if (typeNames.isNotEmpty) {
await connection.execute('DROP TYPE IF EXISTS ${typeNames.join(', ')}');
}
// for (final tableName in tableNames) {
// final result =
// await connection.execute('DROP TABLE IF EXISTS $tableName');
// _logger.fine('Dropped $tableName ($result)');
// }
});
}