withNoConstraints<R> function
Allows you to update the database with foreign key constraints disabled.
You need to call this method within an existing transaction.
Implementation
Future<R> withNoConstraints<R>({required Future<R> Function() action}) async {
await Transaction.current.db.query('SET FOREIGN_KEY_CHECKS=0');
final R result;
try {
result = await action();
} finally {
await Transaction.current.db.query('SET FOREIGN_KEY_CHECKS=1');
}
return result;
}