mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Fixes for forced migration
This commit is contained in:
parent
ba45d0b272
commit
1a4b9ddac6
@ -57,9 +57,15 @@ class ForceMigration extends Command
|
|||||||
{
|
{
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
$company = Company::where('plan', 'free')
|
$company = Company::on(DB_NINJA_1)
|
||||||
->where('is_migrated', false)
|
->whereNull('plan')
|
||||||
|
->orWhereIn('plan', ['','free'])
|
||||||
|
->whereHas('accounts', function ($query){
|
||||||
|
$query->where('account_key', 'NOT LIKE', substr(NINJA_ACCOUNT_KEY, 0, 30) . '%');
|
||||||
|
})
|
||||||
->with('accounts')
|
->with('accounts')
|
||||||
|
->withCount('accounts')
|
||||||
|
->having('accounts_count', '>=', 1)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
$user = $company->accounts->first()->users()->whereNull('public_id')->orWhere('public_id', 0)->first();
|
$user = $company->accounts->first()->users()->whereNull('public_id')->orWhere('public_id', 0)->first();
|
||||||
@ -72,7 +78,6 @@ class ForceMigration extends Command
|
|||||||
|
|
||||||
$data['companies'][$key]['id'] = $account->id;
|
$data['companies'][$key]['id'] = $account->id;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->dispatch(new HostedMigration($user, $data, $db, true));
|
$this->dispatch(new HostedMigration($user, $data, $db, true));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user