mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Possible fix for #667
This commit is contained in:
parent
b48de98865
commit
a2145f6b49
@ -316,6 +316,7 @@ class UpgradeDatabase extends Command
|
|||||||
$notification = '%s #%d uses %s but should use %s. It has been updated. Please verify this in Firefly III.';
|
$notification = '%s #%d uses %s but should use %s. It has been updated. Please verify this in Firefly III.';
|
||||||
$transfer = 'Transfer #%d has been updated to use the correct currencies. Please verify this in Firefly III.';
|
$transfer = 'Transfer #%d has been updated to use the correct currencies. Please verify this in Firefly III.';
|
||||||
$driver = DB::connection()->getDriverName();
|
$driver = DB::connection()->getDriverName();
|
||||||
|
$pgsql = ['pgsql', 'postgresql'];
|
||||||
|
|
||||||
foreach ($types as $type => $operator) {
|
foreach ($types as $type => $operator) {
|
||||||
$query = TransactionJournal
|
$query = TransactionJournal
|
||||||
@ -328,10 +329,10 @@ class UpgradeDatabase extends Command
|
|||||||
->leftJoin('account_meta', 'account_meta.account_id', '=', 'accounts.id')
|
->leftJoin('account_meta', 'account_meta.account_id', '=', 'accounts.id')
|
||||||
->where('transaction_types.type', $type)
|
->where('transaction_types.type', $type)
|
||||||
->where('account_meta.name', 'currency_id');
|
->where('account_meta.name', 'currency_id');
|
||||||
if ($driver === 'postgresql') {
|
if (in_array($driver, $pgsql)) {
|
||||||
$query->where('transaction_journals.transaction_currency_id', '!=', DB::raw('cast(account_meta.data as int)'));
|
$query->where('transaction_journals.transaction_currency_id', '!=', DB::raw('cast(account_meta.data as int)'));
|
||||||
}
|
}
|
||||||
if ($driver !== 'postgresql') {
|
if (!in_array($driver, $pgsql)) {
|
||||||
$query->where('transaction_journals.transaction_currency_id', '!=', DB::raw('account_meta.data'));
|
$query->where('transaction_journals.transaction_currency_id', '!=', DB::raw('account_meta.data'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user