1
0
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:
David Bomba 2021-04-29 18:58:21 +10:00 committed by GitHub
commit 1257703317
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 0 deletions

View File

@ -47,6 +47,7 @@ class CompanyUser extends Pivot
'is_locked',
'slack_webhook_url',
'shop_restricted',
'number_years_active',
];
protected $touches = ['user'];

View File

@ -51,6 +51,7 @@ class CompanyUserTransformer extends EntityTransformer
'archived_at' => (int) $company_user->deleted_at,
'created_at' => (int) $company_user->created_at,
'permissions_updated_at' => (int) $company_user->permissions_updated_at,
'number_years_active' => (int) $company_user->number_years_active,
];
}

View File

@ -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()
{
}
}