add update listener and migrations..
This commit is contained in:
parent
203eeb1885
commit
d50daa3fd8
43
app/Listeners/Update/V30/Version3015.php
Normal file
43
app/Listeners/Update/V30/Version3015.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\Update\V30;
|
||||
|
||||
use App\Abstracts\Listeners\Update as Listener;
|
||||
use App\Events\Install\UpdateFinished as Event;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class Version3015 extends Listener
|
||||
{
|
||||
const ALIAS = 'core';
|
||||
|
||||
const VERSION = '3.0.15';
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(Event $event)
|
||||
{
|
||||
if ($this->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.');
|
||||
}
|
||||
}
|
@ -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',
|
||||
|
53
database/migrations/2022_08_29_000000_core_v3015.php
Normal file
53
database/migrations/2022_08_29_000000_core_v3015.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
// Documents
|
||||
Schema::table('documents', function(Blueprint $table) {
|
||||
$table->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()
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user