Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Schema check breaks #454

Merged
merged 6 commits into from Aug 13, 2020
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 21 additions & 13 deletions src/WebSocketsServiceProvider.php
Expand Up @@ -13,6 +13,7 @@
use BeyondCode\LaravelWebSockets\Statistics\Http\Middleware\Authorize as AuthorizeStatistics;
use BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManager;
use BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManagers\ArrayChannelManager;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Schema;
Expand All @@ -26,23 +27,30 @@ public function boot()
__DIR__.'/../config/websockets.php' => base_path('config/websockets.php'),
], 'config');

if (! Schema::hasTable('websockets_statistics_entries')) {
$this->publishes([
__DIR__.'/../database/migrations/create_websockets_statistics_entries_table.php.stub' => database_path('migrations/'.date('Y_m_d_His', time()).'_create_websockets_statistics_entries_table.php'),
], 'migrations');
}
try {
if (! Schema::hasTable('websockets_statistics_entries')) {
rennokki marked this conversation as resolved.
Show resolved Hide resolved
$this->publishes([
__DIR__.'/../database/migrations/create_websockets_statistics_entries_table.php.stub' => database_path('migrations/'.date('Y_m_d_His', time()).'_create_websockets_statistics_entries_table.php'),
rennokki marked this conversation as resolved.
Show resolved Hide resolved
], 'migrations');
}

$this
$this
->registerRoutes()
->registerDashboardGate();

$this->loadViewsFrom(__DIR__.'/../resources/views/', 'websockets');

$this->commands([
Console\StartWebSocketServer::class,
Console\CleanStatistics::class,
Console\RestartWebSocketServer::class,
]);
$this->loadViewsFrom(__DIR__.'/../resources/views/', 'websockets');

$this->commands([
Console\StartWebSocketServer::class,
Console\CleanStatistics::class,
Console\RestartWebSocketServer::class,
]);
} catch (QueryException $e) {
rennokki marked this conversation as resolved.
Show resolved Hide resolved
// Exception raised by composer update
// Usually happens when doing on CI where no DB exists at start
// Either way if DB connection not obtained
// Catching and doing nothing is ignore for composer update
}
}

public function register()
Expand Down