isUpgradePending static method
Whether opening the existing database runs migrations, as its version
is lower than version.
Foreign keys stay disabled while migrating then, as they can't be toggled within the transaction of migrations, e.g. for recreating tables.
Implementation
static Future<bool> isUpgradePending(
final Database database,
final int version,
) async {
final currentVersion = await database.getVersion();
return currentVersion != 0 && currentVersion < version;
}