added more indexes

This commit is contained in:
Denis Duliçi 2020-06-09 00:40:08 +03:00
parent f7c8f4b785
commit 4c62e391b7
3 changed files with 74 additions and 0 deletions

View File

@ -0,0 +1,29 @@
<?php
namespace App\Listeners\Update\V20;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use Illuminate\Support\Facades\Artisan;
class Version2014 extends Listener
{
const ALIAS = 'core';
const VERSION = '2.0.14';
/**
* Handle the event.
*
* @param $event
* @return void
*/
public function handle(Event $event)
{
if ($this->skipThisUpdate($event)) {
return;
}
Artisan::call('migrate', ['--force' => true]);
}
}

View File

@ -20,6 +20,7 @@ class Event extends Provider
'App\Listeners\Update\V20\Version207',
'App\Listeners\Update\V20\Version208',
'App\Listeners\Update\V20\Version209',
'App\Listeners\Update\V20\Version2014',
],
'Illuminate\Auth\Events\Login' => [
'App\Listeners\Auth\Login',

View File

@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CoreV2014 extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$doc_types = ['invoice', 'bill'];
$doc_tables = ['histories', 'items', 'item_taxes', 'totals'];
foreach ($doc_types as $doc_type) {
foreach ($doc_tables as $doc_table) {
Schema::table($doc_type . '_' . $doc_table, function (Blueprint $table) use ($doc_type) {
$table->index($doc_type . '_id');
});
}
}
Schema::table('transactions', function (Blueprint $table) {
$table->index('account_id');
$table->index('category_id');
$table->index('contact_id');
$table->index('document_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}