recreateAllViews method Null safety

Future<void> recreateAllViews()

Drops and re-creates all views known to the database.

Calling this may be useful in migrations that could potentially affect views. This includes changes to a view itself, but changes to tables that a view reads from may also warrant re-creating the view to make sure it's still valid.

Implementation

Future<void> recreateAllViews() async {
  for (final entity in _db.allSchemaEntities) {
    if (entity is ViewInfo) {
      await drop(entity);
      await createView(entity);
    }
  }
}