Skip to content

Commit e518f70

Browse files
committed
#150 Fixed problem with command
1 parent 16f2ad8 commit e518f70

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Commands/RefreshBalance.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ public function handle(): void
3939
{
4040
app(ProxyService::class)->fresh();
4141
app(DbService::class)->transaction(function () {
42-
$wallet = config('wallet.wallet.table', 'wallets');
43-
app(DbService::class)
44-
->connection()
45-
->table($wallet)
46-
->update(['balance' => 0]);
47-
4842
if (app(DbService::class)->connection() instanceof SQLiteConnection) {
43+
$wallet = config('wallet.wallet.table', 'wallets');
44+
app(DbService::class)
45+
->connection()
46+
->table($wallet)
47+
->update(['balance' => 0]);
48+
4949
$this->sqliteUpdate();
5050
} else {
5151
$this->multiUpdate();
@@ -89,7 +89,7 @@ protected function multiUpdate(): void
8989
->connection()
9090
->table($wallet)
9191
->joinSub($availableBalance, 'b', $joinClause, null, null, 'left')
92-
->update(['balance' => app(DbService::class)->raw('b.balance')]);
92+
->update(["$wallet.balance" => app(DbService::class)->raw('ifnull(b.balance, 0)')]);
9393
}
9494

9595
}

0 commit comments

Comments
 (0)