upsert method
- Session session
Creates or updates the provided session in the database.
Implementation
Future<Session> upsert(Session session) async {
  final result = await safe((db) async {
    final Session stored = _SessionDb.fromDb(
      await db
          .into(db.sessions)
          .insertReturning(
            session.toDb(),
            onConflict: DoUpdate((_) => session.toDb()),
          ),
    );
    return stored;
  });
  return result ?? session;
}