areDatabaseTablesExist static method
Implementation
static Future<bool> areDatabaseTablesExist(
String filePath, List<String> tables) async {
Database database = await getDatabase(filePath);
String tableNames = tables.map((table) => '"$table"').join(',');
try {
var tableQuery = await database.rawQuery(
'SELECT name FROM sqlite_master WHERE type="table" AND name IN ($tableNames);');
//printColor('Expected Tables: $tables');
//printColor('Found Tables: ${tableQuery.map((row) => row['name'])}');
return tableQuery.length == tables.length;
} catch (e) {
// Handle the exception here
//printError('Error occurred while checking for tables: $e');
return false; // Or any other appropriate action
}
}