From d50daa3fd8ccad638f8c09a15c0b5e82d251aa42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Wed, 31 May 2023 14:47:46 +0300 Subject: [PATCH] add update listener and migrations.. --- app/Listeners/Update/V30/Version3015.php | 43 +++++++++++++++ app/Providers/Event.php | 1 + .../2022_08_29_000000_core_v3015.php | 53 +++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 app/Listeners/Update/V30/Version3015.php create mode 100644 database/migrations/2022_08_29_000000_core_v3015.php diff --git a/app/Listeners/Update/V30/Version3015.php b/app/Listeners/Update/V30/Version3015.php new file mode 100644 index 000000000..44124da7a --- /dev/null +++ b/app/Listeners/Update/V30/Version3015.php @@ -0,0 +1,43 @@ +skipThisUpdate($event)) { + return; + } + + Log::channel('stdout')->info('Updating to 3.0.15 version...'); + + $this->updateDatabase(); + + Log::channel('stdout')->info('Done!'); + } + + public function updateDatabase(): void + { + Log::channel('stdout')->info('Updating database...'); + + Artisan::call('migrate', ['--force' => true]); + + Log::channel('stdout')->info('Database updated.'); + } +} diff --git a/app/Providers/Event.php b/app/Providers/Event.php index 13c2b36ad..b9a90a85e 100644 --- a/app/Providers/Event.php +++ b/app/Providers/Event.php @@ -23,6 +23,7 @@ class Event extends Provider 'App\Listeners\Update\V30\Version309', 'App\Listeners\Update\V30\Version3013', 'App\Listeners\Update\V30\Version3014', + 'App\Listeners\Update\V30\Version3015', ], 'Illuminate\Auth\Events\Login' => [ 'App\Listeners\Auth\Login', diff --git a/database/migrations/2022_08_29_000000_core_v3015.php b/database/migrations/2022_08_29_000000_core_v3015.php new file mode 100644 index 000000000..0da0db054 --- /dev/null +++ b/database/migrations/2022_08_29_000000_core_v3015.php @@ -0,0 +1,53 @@ +index('contact_id'); + }); + + // User Companies + Schema::table('user_companies', function(Blueprint $table) { + $table->index('user_id'); + $table->index('company_id'); + }); + + // User Roles + Schema::table('user_companies', function(Blueprint $table) { + $table->index('user_id'); + $table->index('role_id'); + }); + + // Transactions + Schema::table('transactions', function(Blueprint $table) { + $table->index('number'); + }); + + // Roles + Schema::table('roles', function(Blueprint $table) { + $table->index('name'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +};