mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Skip creation using if statement.
This commit is contained in:
parent
a20622ac0c
commit
7009b444d9
@ -33,7 +33,7 @@ use Illuminate\Console\Command;
|
|||||||
class CorrectAccountBalance extends Command
|
class CorrectAccountBalance extends Command
|
||||||
{
|
{
|
||||||
use ShowsFriendlyMessages;
|
use ShowsFriendlyMessages;
|
||||||
public const string CONFIG_NAME = '620_correct_balances';
|
public const string CONFIG_NAME = '610_correct_balances';
|
||||||
protected $description = 'Recalculate all account balance amounts';
|
protected $description = 'Recalculate all account balance amounts';
|
||||||
|
|
||||||
protected $signature = 'firefly-iii:correct-account-balance {--F|force : Force the execution of this command.}';
|
protected $signature = 'firefly-iii:correct-account-balance {--F|force : Force the execution of this command.}';
|
||||||
|
@ -49,10 +49,12 @@ class AccountTypeSeeder extends Seeder
|
|||||||
AccountType::LIABILITY_CREDIT,
|
AccountType::LIABILITY_CREDIT,
|
||||||
];
|
];
|
||||||
foreach ($types as $type) {
|
foreach ($types as $type) {
|
||||||
try {
|
if(null === AccountType::where('type', $type)->first()) {
|
||||||
AccountType::create(['type' => $type]);
|
try {
|
||||||
} catch (\PDOException $e) {
|
AccountType::create(['type' => $type]);
|
||||||
// @ignoreException
|
} catch (\PDOException $e) {
|
||||||
|
// @ignoreException
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,11 +44,10 @@ class ConfigSeeder extends Seeder
|
|||||||
'data' => 1,
|
'data' => 1,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (null !== $entry) {
|
$version = (int) config('firefly.db_version');
|
||||||
$version = (int)config('firefly.db_version');
|
$entry->data = $version;
|
||||||
$entry->data = $version;
|
$entry->save();
|
||||||
$entry->save();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,10 +60,12 @@ class LinkTypeSeeder extends Seeder
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
foreach ($types as $type) {
|
foreach ($types as $type) {
|
||||||
try {
|
if (null === LinkType::where('name', $type['name'])->first()) {
|
||||||
LinkType::create($type);
|
try {
|
||||||
} catch (\PDOException $e) {
|
LinkType::create($type);
|
||||||
// @ignoreException
|
} catch (\PDOException $e) {
|
||||||
|
// @ignoreException
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,11 +46,14 @@ class PermissionSeeder extends Seeder
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
foreach ($roles as $role) {
|
foreach ($roles as $role) {
|
||||||
try {
|
if (null === Role::where('name', $role['name'])->first()) {
|
||||||
Role::create($role);
|
try {
|
||||||
} catch (\PDOException $e) {
|
Role::create($role);
|
||||||
// @ignoreException
|
} catch (\PDOException $e) {
|
||||||
|
// @ignoreException
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,10 +71,12 @@ class TransactionCurrencySeeder extends Seeder
|
|||||||
$currencies[] = ['code' => 'HRK', 'name' => 'Croatian kuna', 'symbol' => 'kn', 'decimal_places' => 2];
|
$currencies[] = ['code' => 'HRK', 'name' => 'Croatian kuna', 'symbol' => 'kn', 'decimal_places' => 2];
|
||||||
|
|
||||||
foreach ($currencies as $currency) {
|
foreach ($currencies as $currency) {
|
||||||
try {
|
if(null === TransactionCurrency::where('code', $currency['code'])->first()) {
|
||||||
TransactionCurrency::create($currency);
|
try {
|
||||||
} catch (\PDOException $e) {
|
TransactionCurrency::create($currency);
|
||||||
// @ignoreException
|
} catch (\PDOException $e) {
|
||||||
|
// @ignoreException
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,10 +44,12 @@ class TransactionTypeSeeder extends Seeder
|
|||||||
];
|
];
|
||||||
|
|
||||||
foreach ($types as $type) {
|
foreach ($types as $type) {
|
||||||
try {
|
if(null === TransactionType::where('type', $type)->first()) {
|
||||||
TransactionType::create(['type' => $type]);
|
try {
|
||||||
} catch (\PDOException $e) {
|
TransactionType::create(['type' => $type]);
|
||||||
// @ignoreException
|
} catch (\PDOException $e) {
|
||||||
|
// @ignoreException
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,10 +45,12 @@ class UserRoleSeeder extends Seeder
|
|||||||
|
|
||||||
/** @var string $role */
|
/** @var string $role */
|
||||||
foreach ($roles as $role) {
|
foreach ($roles as $role) {
|
||||||
try {
|
if(null === UserRole::where('title', $role)->first()) {
|
||||||
UserRole::create(['title' => $role]);
|
try {
|
||||||
} catch (\PDOException $e) {
|
UserRole::create(['title' => $role]);
|
||||||
// @ignoreException
|
} catch (\PDOException $e) {
|
||||||
|
// @ignoreException
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user