Minor fixes for bulk import

This commit is contained in:
David Bomba 2020-11-16 15:40:52 +11:00
parent a8f186c921
commit 77929a6bc3
2 changed files with 4 additions and 3 deletions

View File

@ -88,14 +88,15 @@ class ImportMigrations extends Command
'confirmation_code' => $this->createDbHash(config('database.default')), 'confirmation_code' => $this->createDbHash(config('database.default')),
]); ]);
CompanyToken::unguard();
$company_token = CompanyToken::create([ $company_token = CompanyToken::create([
'user_id' => $user->id, 'user_id' => $user->id,
'company_id' => $company->id, 'company_id' => $company->id,
'account_id' => $account->id, 'account_id' => $account->id,
'name' => 'test token', 'name' => 'First token',
'token' => Str::random(64), 'token' => Str::random(64),
]); ]);
$user->companies()->attach($company->id, [ $user->companies()->attach($company->id, [
'account_id' => $account->id, 'account_id' => $account->id,
'is_owner' => 1, 'is_owner' => 1,

View File

@ -107,7 +107,7 @@ class StartMigration implements ShouldQueue
$data = json_decode(file_get_contents($file), 1); $data = json_decode(file_get_contents($file), 1);
Import::dispatchNow($data['data'], $this->company, $this->user); Import::dispatchNow($data, $this->company, $this->user);
} catch (NonExistingMigrationFile | ProcessingMigrationArchiveFailed | ResourceNotAvailableForMigration | MigrationValidatorFailed | ResourceDependencyMissing $e) { } catch (NonExistingMigrationFile | ProcessingMigrationArchiveFailed | ResourceNotAvailableForMigration | MigrationValidatorFailed | ResourceDependencyMissing $e) {
Mail::to($this->user)->send(new MigrationFailed($e, $e->getMessage())); Mail::to($this->user)->send(new MigrationFailed($e, $e->getMessage()));