onUpgrade method

void onUpgrade(
  1. List<Future<dynamic Function(Database, int, int)>> fn
)

Executes when creating database. This method should be called before using eloquent.

DB.instance.onUpgrade([
      Future(() {
        return (Database db, int oldversion,int newversion) async {};
      }),
  ]);

//Or
DB.instance.onUpgrade([UserEloquent.onUpgrade]);

Implementation

void onUpgrade(List<Future<Function(Database, int, int)>> fn) {
  _onUpgrade.addAll(fn);
}