mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
Merge pull request #5561 from turbo124/v5-develop
Add parameter to reduce query burden
This commit is contained in:
commit
1257703317
@ -47,6 +47,7 @@ class CompanyUser extends Pivot
|
|||||||
'is_locked',
|
'is_locked',
|
||||||
'slack_webhook_url',
|
'slack_webhook_url',
|
||||||
'shop_restricted',
|
'shop_restricted',
|
||||||
|
'number_years_active',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $touches = ['user'];
|
protected $touches = ['user'];
|
||||||
|
@ -51,6 +51,7 @@ class CompanyUserTransformer extends EntityTransformer
|
|||||||
'archived_at' => (int) $company_user->deleted_at,
|
'archived_at' => (int) $company_user->deleted_at,
|
||||||
'created_at' => (int) $company_user->created_at,
|
'created_at' => (int) $company_user->created_at,
|
||||||
'permissions_updated_at' => (int) $company_user->permissions_updated_at,
|
'permissions_updated_at' => (int) $company_user->permissions_updated_at,
|
||||||
|
'number_years_active' => (int) $company_user->number_years_active,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Models\CompanyUser;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddNumberYearsActiveToCompanyUsersTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('company_user', function (Blueprint $table) {
|
||||||
|
$table->unsignedInteger('number_years_active')->default(3);
|
||||||
|
});
|
||||||
|
|
||||||
|
CompanyUser::cursor()->each(function ($cu){
|
||||||
|
$cu->number_years_active = 3;
|
||||||
|
$cu->save();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user