mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Multi-db support
This commit is contained in:
parent
782ae969a4
commit
7b797da220
@ -54,7 +54,8 @@ class InitLookup extends Command
|
||||
|
||||
config(['database.default' => DB_NINJA_LOOKUP]);
|
||||
|
||||
$dbServer = DbServer::whereName($this->option('database'))->first();
|
||||
$database = $this->option('database');
|
||||
$dbServer = DbServer::whereName($database)->first();
|
||||
|
||||
if ($this->option('truncate')) {
|
||||
$this->truncateTables();
|
||||
@ -72,6 +73,7 @@ class InitLookup extends Command
|
||||
}
|
||||
|
||||
$this->info($this->log);
|
||||
$this->info('Valid: ' . ($this->isValid ? RESULT_SUCCESS : RESULT_FAILURE));
|
||||
|
||||
if ($this->option('validate')) {
|
||||
if ($errorEmail = env('ERROR_EMAIL')) {
|
||||
@ -105,7 +107,6 @@ class InitLookup extends Command
|
||||
config(['database.default' => DB_NINJA_LOOKUP]);
|
||||
|
||||
foreach ($data as $companyId => $company) {
|
||||
$this->logMessage('Company Id: ' . $companyId);
|
||||
|
||||
if ($this->option('validate')) {
|
||||
$lookupCompany = LookupCompany::whereDbServerId($dbServerId)->whereCompanyId($companyId)->first();
|
||||
|
@ -34,13 +34,13 @@ class PruneData extends Command
|
||||
$sql = 'select c.id
|
||||
from companies c
|
||||
left join accounts a on a.company_id = c.id
|
||||
left join clients c on c.account_id = a.id
|
||||
left join clients cl on cl.account_id = a.id
|
||||
left join tasks t on t.account_id = a.id
|
||||
left join expenses e on e.account_id = a.id
|
||||
left join users u on u.account_id = a.id and u.registered = 1
|
||||
where c.created_at < DATE_SUB(now(), INTERVAL 6 MONTH)
|
||||
group by c.id
|
||||
having count(c.id) = 0
|
||||
having count(cl.id) = 0
|
||||
and count(t.id) = 0
|
||||
and count(e.id) = 0
|
||||
and count(u.id) = 0';
|
||||
|
Loading…
x
Reference in New Issue
Block a user