upsert method

Future<void> upsert(
  1. UserId userId
)

Creates or updates the provided userId in the database.

Implementation

Future<void> upsert(UserId userId) async {
  _userId = userId;

  await safe((db) async {
    await db
        .into(db.accounts)
        .insert(
          AccountRow(id: 0, userId: userId.val),
          mode: InsertMode.insertOrReplace,
        );
  }, tag: 'account.upsert($userId)');
}