mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Updated company migration
This commit is contained in:
parent
a2dc354e2c
commit
90eccfcaa0
@ -16,7 +16,7 @@ return new class extends Migration
|
||||
// ->cursor()
|
||||
// ->each(function($company){
|
||||
|
||||
// if($company->tax_data?->version == 'alpha')
|
||||
// if($company->tax_data?->version == 'alpha' && ($company->tax_data->seller_subregion ?? false))
|
||||
// {
|
||||
|
||||
// $company->update(['tax_data' => new \App\DataMapper\Tax\TaxModel($company->tax_data)]);
|
||||
|
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use App\Models\Company;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if(Ninja::isSelfHost())
|
||||
{
|
||||
|
||||
Company::whereNotNull('tax_data')
|
||||
->cursor()
|
||||
->each(function ($company) {
|
||||
|
||||
if($company->tax_data?->version == 'alpha' && ($company->tax_data->seller_subregion ?? false)) {
|
||||
|
||||
$company->update(['tax_data' => new \App\DataMapper\Tax\TaxModel($company->tax_data)]);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user