verifySchema method Null safety
- DatabaseItem item
Verifies the database schema for the current item
Implementation
verifySchema(DatabaseItem item) async {
final tableName = item.tableName;
// Get current columns in database for [tableName]
final columns = schema[tableName];
// Complete verification and adjustment of schema
if (columns != null && !DatabaseItem.schemaVerified) {
// Add columns not in the table schema
for (final entry in item.schema.entries) {
if (!columns.contains(entry.key)) {
await addColumn(tableName, entry.key, entry.value);
}
}
}
DatabaseItem.schemaVerified = true;
}