wip performance

This commit is contained in:
salam committed 2026-09-25 11:08:33 +02:00
1 parent 7bf4258c4a
commit 5ffbc07564
11 files changed
+569 -26

No files matched your search

@@ -2,6 +2,7 @@
namespace App\Actions; namespace App\Actions;
use App\Models\SofaScoreRosa;
use App\Models\StatisticFixtures; use App\Models\StatisticFixtures;
class LoadStatisticFixturesMatchOptions class LoadStatisticFixturesMatchOptions
@@ -11,11 +12,13 @@ class LoadStatisticFixturesMatchOptions
if (! $league_id) { if (! $league_id) {
return []; return [];
} }
$team_map = SofaScoreRosa::pluck('ss_team_name', 'ss_team_id')->toArray();
$res = StatisticFixtures::where('league_id', $league_id)->get(); $res = StatisticFixtures::where('league_id', $league_id)->get();
$arr = []; $arr = [];
foreach ($res as $val) { foreach ($res as $val) {
$arr[$val->id] = $val->starttime->format('Y-m-d H:i') . ' - ' . $val->home->ss_team_name . ' vs ' . $val->away->ss_team_name; $arr[$val->id] = $val->starttime->format('Y-m-d H:i').' - '.$team_map[$val->home_id].' vs '.$team_map[$val->away_id];
} }
return $arr; return $arr;
@@ -37,6 +37,8 @@ class LoadPlayerSelection
$player = SofaScorePlayerPerSeason::with('details')->where('ss_team_id', $team_id)->whereIn('season', $season)->get(); $player = SofaScorePlayerPerSeason::with('details')->where('ss_team_id', $team_id)->whereIn('season', $season)->get();
// dd($player);
$arr = []; $arr = [];
foreach ($player as $val) { foreach ($player as $val) {
if ($val->details) { if ($val->details) {
@@ -3,6 +3,7 @@
namespace App\Filament\Widgets\Charts\LoadEvents; namespace App\Filament\Widgets\Charts\LoadEvents;
use App\Filament\Pages\Selections\Helper\GetSeason; use App\Filament\Pages\Selections\Helper\GetSeason;
use App\Models\SofaScoreRosa;
use App\Models\StatistikoEvent; use App\Models\StatistikoEvent;
use App\Models\StatistikoPlayer; use App\Models\StatistikoPlayer;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
@@ -87,13 +88,14 @@ class LoadEventsQuery
} }
} }
$team_map = SofaScoreRosa::pluck('ss_team_name', 'ss_team_id')->toArray();
// dd($handicap_range, $total_range); // dd($handicap_range, $total_range);
/** /**
* STATTISTIC DATA * STATTISTIC DATA
*/ */
// dd($team_id, $home_id, $away_id); // dd($team_id, $home_id, $away_id);
$res = StatistikoEvent::with('home')->with('away') $res = StatistikoEvent::where(function ($query) use ($league_id, $similar_past_matches) {
->where(function ($query) use ($league_id, $similar_past_matches) {
switch ($similar_past_matches) { switch ($similar_past_matches) {
case 'none': case 'none':
case 'league': case 'league':
@@ -155,8 +157,8 @@ class LoadEventsQuery
$tmp['exp_handicap'] = $value->exp_handicap; $tmp['exp_handicap'] = $value->exp_handicap;
$tmp['exp_total'] = $value->exp_total; $tmp['exp_total'] = $value->exp_total;
$tmp['result_code'] = $value->result_code; $tmp['result_code'] = $value->result_code;
$tmp['home'] = $value->home->ss_team_name ?? 0; $tmp['home'] = $team_map[$value->home_id] ?? 0;
$tmp['away'] = $value->away->ss_team_name ?? 0; $tmp['away'] = $team_map[$value->away_id] ?? 0;
switch ($statistic_type) { switch ($statistic_type) {
case 'gls': case 'gls':
+11 -15
View File
@@ -2,6 +2,7 @@
namespace App\Filament\Widgets\Charts; namespace App\Filament\Widgets\Charts;
use App\Models\SofaScoreRosa;
use App\Models\StatisticFixtures; use App\Models\StatisticFixtures;
use App\Models\StatistikoEvent; use App\Models\StatistikoEvent;
use App\Models\StatistikoPlayer; use App\Models\StatistikoPlayer;
@@ -22,8 +23,6 @@ class LoadPerformance
$team_position = $filter['team_position']; $team_position = $filter['team_position'];
$team_id = (int) $filter['team_id'] ?? 0;
if (! $league_id) { if (! $league_id) {
return []; return [];
} }
@@ -31,18 +30,15 @@ class LoadPerformance
return []; return [];
} }
$match = StatisticFixtures::with('home')->with('away')->where('id', $match_id)->first(); $team_map = SofaScoreRosa::pluck('ss_team_name', 'ss_team_id')->toArray();
$match = StatisticFixtures::where('id', $match_id)->first();
if (! $match) { if (! $match) {
return []; return [];
} }
$home_id = $match->home_id ?? 0; $home_id = $match->home_id ?? 0;
$away_id = $match->away_id ?? 0; $away_id = $match->away_id ?? 0;
// $labels[] = round($value['starttime']->diffInDays(Carbon::now()));
// $playing_date[] = $value['starttime']->format('Y-m-d H:i');
$res = StatistikoEvent::where('league_id', $league_id)->get(); $res = StatistikoEvent::where('league_id', $league_id)->get();
$home_matches = []; $home_matches = [];
@@ -63,14 +59,14 @@ class LoadPerformance
$labels[] = round($val->starttime->diffInDays(Carbon::now())); $labels[] = round($val->starttime->diffInDays(Carbon::now()));
$date_home[] = $val['starttime']->format('Y-m-d H:i'); $date_home[] = $val['starttime']->format('Y-m-d H:i');
$results_home[] = $val['gls_h'].' : '.$val['gls_a']; $results_home[] = $val['gls_h'].' : '.$val['gls_a'];
$events_home[] = $val->home->ss_team_name.' vs '.$val->away->ss_team_name; $events_home[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id];
$home_matches[] = $val->match_id; $home_matches[] = $val->match_id;
} }
if ($val->away_id == $away_id) { if ($val->away_id == $away_id) {
$labels[] = round($val->starttime->diffInDays(Carbon::now())); $labels[] = round($val->starttime->diffInDays(Carbon::now()));
$date_away[] = $val['starttime']->format('Y-m-d H:i'); $date_away[] = $val['starttime']->format('Y-m-d H:i');
$results_away[] = $val['gls_h'].' : '.$val['gls_a']; $results_away[] = $val['gls_h'].' : '.$val['gls_a'];
$events_away[] = $val->home->ss_team_name.' vs '.$val->away->ss_team_name; $events_home[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id];
$away_matches[] = $val->match_id; $away_matches[] = $val->match_id;
} }
break; break;
@@ -79,14 +75,14 @@ class LoadPerformance
$labels[] = round($val->starttime->diffInDays(Carbon::now())); $labels[] = round($val->starttime->diffInDays(Carbon::now()));
$date_home[] = $val['starttime']->format('Y-m-d H:i'); $date_home[] = $val['starttime']->format('Y-m-d H:i');
$results_home[] = $val['gls_h'].' : '.$val['gls_a']; $results_home[] = $val['gls_h'].' : '.$val['gls_a'];
$events_home[] = $val->home->name.' vs '.$val->away->name; $events_home[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id];
$home_matches[] = $val->match_id; $home_matches[] = $val->match_id;
} }
if ($val->home_id == $away_id) { if ($val->home_id == $away_id) {
$labels[] = round($val->starttime->diffInDays(Carbon::now())); $labels[] = round($val->starttime->diffInDays(Carbon::now()));
$date_away[] = $val['starttime']->format('Y-m-d H:i'); $date_away[] = $val['starttime']->format('Y-m-d H:i');
$results_away[] = $val['gls_h'].' : '.$val['gls_a']; $results_away[] = $val['gls_h'].' : '.$val['gls_a'];
$events_away[] = $val->home->ss_team_name.' vs '.$val->away->ss_team_name; $events_home[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id];
$away_matches[] = $val->match_id; $away_matches[] = $val->match_id;
} }
break; break;
@@ -95,14 +91,14 @@ class LoadPerformance
$labels[] = round($val->starttime->diffInDays(Carbon::now())); $labels[] = round($val->starttime->diffInDays(Carbon::now()));
$date_home[] = $val['starttime']->format('Y-m-d H:i'); $date_home[] = $val['starttime']->format('Y-m-d H:i');
$results_home[] = $val['gls_h'].' : '.$val['gls_a']; $results_home[] = $val['gls_h'].' : '.$val['gls_a'];
$events_home[] = $val->home->ss_team_name.' vs '.$val->away->ss_team_name; $events_home[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id];
$home_matches[] = $val->match_id; $home_matches[] = $val->match_id;
} }
if ($val->home_id == $away_id or $val->away_id == $away_id) { if ($val->home_id == $away_id or $val->away_id == $away_id) {
$labels[] = round($val->starttime->diffInDays(Carbon::now())); $labels[] = round($val->starttime->diffInDays(Carbon::now()));
$date_away[] = $val['starttime']->format('Y-m-d H:i'); $date_away[] = $val['starttime']->format('Y-m-d H:i');
$results_away[] = $val['gls_h'].' : '.$val['gls_a']; $results_away[] = $val['gls_h'].' : '.$val['gls_a'];
$events_away[] = $val->home->ss_team_name.' vs '.$val->away->ss_team_name; $events_home[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id];
$away_matches[] = $val->match_id; $away_matches[] = $val->match_id;
} }
break; break;
@@ -135,7 +131,7 @@ class LoadPerformance
$data = [ $data = [
'datasets' => [ 'datasets' => [
[ [
'label' => $match->home->ss_team_name, 'label' => $team_map[$match->home_id],
'playing_date' => $date_home, 'playing_date' => $date_home,
'results_per_event' => $results_home, 'results_per_event' => $results_home,
'events' => $events_home, 'events' => $events_home,
@@ -246,7 +242,7 @@ class LoadPerformance
'hidden' => true, 'hidden' => true,
], ],
[ [
'label' => $match->away->ss_team_name, 'label' => $team_map[$match->away_id],
'playing_date' => $date_away, 'playing_date' => $date_away,
'results_per_event' => $results_away, 'results_per_event' => $results_away,
'events' => $events_away, 'events' => $events_away,
@@ -0,0 +1,65 @@
<?php
namespace App\Providers;
use App\Models\User;
use Illuminate\Support\Facades\Gate;
use Laravel\Telescope\IncomingEntry;
use Laravel\Telescope\Telescope;
use Laravel\Telescope\TelescopeApplicationServiceProvider;
class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
// Telescope::night();
$this->hideSensitiveRequestDetails();
$isLocal = $this->app->environment('local');
Telescope::filter(function (IncomingEntry $entry) use ($isLocal) {
return $isLocal ||
$entry->isReportableException() ||
$entry->isFailedRequest() ||
$entry->isFailedJob() ||
$entry->isScheduledTask() ||
$entry->hasMonitoredTag();
});
}
/**
* Prevent sensitive request details from being logged by Telescope.
*/
protected function hideSensitiveRequestDetails(): void
{
if ($this->app->environment('local')) {
return;
}
Telescope::hideRequestParameters(['_token']);
Telescope::hideRequestHeaders([
'cookie',
'x-csrf-token',
'x-xsrf-token',
]);
}
/**
* Register the Telescope gate.
*
* This gate determines who can access Telescope in non-local environments.
*/
protected function gate(): void
{
Gate::define('viewTelescope', function (User $user) {
return in_array($user->email, [
//
]);
});
}
}
+3 -5
View File
@@ -1,9 +1,7 @@
<?php <?php
use App\Providers\AppServiceProvider;
use App\Providers\Filament\AdminPanelProvider;
return [ return [
AppServiceProvider::class, App\Providers\AppServiceProvider::class,
AdminPanelProvider::class, App\Providers\Filament\AdminPanelProvider::class,
App\Providers\TelescopeServiceProvider::class,
]; ];
+1
View File
@@ -35,6 +35,7 @@
"laravel/pail": "*", "laravel/pail": "*",
"laravel/pint": "^1.26", "laravel/pint": "^1.26",
"laravel/sail": "^1.41", "laravel/sail": "^1.41",
"laravel/telescope": "^5.25",
"mockery/mockery": "^1.6", "mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.6", "nunomaduro/collision": "^8.6",
"pestphp/pest": "^3.8", "pestphp/pest": "^3.8",
Generated
+125 -1
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "4231b4a7cf9df2691defc03b29b6494b", "content-hash": "8d093dac61786eebf4170291bee0c826",
"packages": [ "packages": [
{ {
"name": "agencetwogether/hookshelper", "name": "agencetwogether/hookshelper",
@@ -11032,6 +11032,130 @@
}, },
"time": "2026-09-18T14:34:46+00:00" "time": "2026-09-18T14:34:46+00:00"
}, },
{
"name": "laravel/sentinel",
"version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/sentinel.git",
"reference": "972d9885d9d14312a118e9565c4e6ecc5e751ea1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/sentinel/zipball/972d9885d9d14312a118e9565c4e6ecc5e751ea1",
"reference": "972d9885d9d14312a118e9565c4e6ecc5e751ea1",
"shasum": ""
},
"require": {
"ext-json": "*",
"illuminate/container": "^8.37|^9.0|^10.0|^11.0|^12.0|^13.0",
"php": "^8.0"
},
"require-dev": {
"laravel/pint": "^1.27",
"orchestra/testbench": "^6.47.1|^7.56|^8.37|^9.16|^10.9|^11.0",
"phpstan/phpstan": "^2.1.33"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Laravel\\Sentinel\\SentinelServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Laravel\\Sentinel\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
},
{
"name": "Mior Muhammad Zaki",
"email": "mior@laravel.com"
}
],
"support": {
"source": "https://github.com/laravel/sentinel/tree/v1.1.0"
},
"time": "2026-03-24T14:03:38+00:00"
},
{
"name": "laravel/telescope",
"version": "v5.25.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/telescope.git",
"reference": "65fe6724f8688de01dfa74b28a0edc191bc3caa8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/telescope/zipball/65fe6724f8688de01dfa74b28a0edc191bc3caa8",
"reference": "65fe6724f8688de01dfa74b28a0edc191bc3caa8",
"shasum": ""
},
"require": {
"ext-json": "*",
"laravel/framework": "^8.37|^9.0|^10.0|^11.0|^12.0|^13.0",
"laravel/sentinel": "^1.0",
"php": "^8.0",
"symfony/console": "^5.3|^6.0|^7.0|^8.0",
"symfony/var-dumper": "^5.0|^6.0|^7.0|^8.0"
},
"require-dev": {
"ext-gd": "*",
"guzzlehttp/guzzle": "^6.0|^7.0|^8.0",
"laravel/octane": "^1.4|^2.0",
"orchestra/testbench": "^6.48|^7.57|^8.38|^9.15|^10.8|^11.0",
"phpstan/phpstan": "^2.2.9"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Laravel\\Telescope\\TelescopeServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Laravel\\Telescope\\": "src/",
"Laravel\\Telescope\\Database\\Factories\\": "database/factories/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
},
{
"name": "Mohamed Said",
"email": "mohamed@laravel.com"
}
],
"description": "An elegant debug assistant for the Laravel framework.",
"keywords": [
"debugging",
"laravel",
"monitoring"
],
"support": {
"source": "https://github.com/laravel/telescope/tree/v5.25.0"
},
"time": "2026-09-09T14:16:19+00:00"
},
{ {
"name": "mockery/mockery", "name": "mockery/mockery",
"version": "1.6.15", "version": "1.6.15",
+212
View File
@@ -0,0 +1,212 @@
<?php
use Laravel\Telescope\Http\Middleware\Authorize;
use Laravel\Telescope\Watchers;
return [
/*
|--------------------------------------------------------------------------
| Telescope Master Switch
|--------------------------------------------------------------------------
|
| This option may be used to disable all Telescope watchers regardless
| of their individual configuration, which simply provides a single
| and convenient way to enable or disable Telescope data storage.
|
*/
'enabled' => env('TELESCOPE_ENABLED', true),
/*
|--------------------------------------------------------------------------
| Telescope Domain
|--------------------------------------------------------------------------
|
| This is the subdomain where Telescope will be accessible from. If the
| setting is null, Telescope will reside under the same domain as the
| application. Otherwise, this value will be used as the subdomain.
|
*/
'domain' => env('TELESCOPE_DOMAIN'),
/*
|--------------------------------------------------------------------------
| Telescope Path
|--------------------------------------------------------------------------
|
| This is the URI path where Telescope will be accessible from. Feel free
| to change this path to anything you like. Note that the URI will not
| affect the paths of its internal API that aren't exposed to users.
|
*/
'path' => env('TELESCOPE_PATH', 'telescope'),
/*
|--------------------------------------------------------------------------
| Telescope Storage Driver
|--------------------------------------------------------------------------
|
| This configuration options determines the storage driver that will
| be used to store Telescope's data. In addition, you may set any
| custom options as needed by the particular driver you choose.
|
*/
'driver' => env('TELESCOPE_DRIVER', 'database'),
'storage' => [
'database' => [
'connection' => env('DB_CONNECTION', 'mysql'),
'chunk' => 1000,
],
],
/*
|--------------------------------------------------------------------------
| Telescope Queue
|--------------------------------------------------------------------------
|
| This configuration options determines the queue connection and queue
| which will be used to process ProcessPendingUpdate jobs. This can
| be changed if you would prefer to use a non-default connection.
|
*/
'queue' => [
'connection' => env('TELESCOPE_QUEUE_CONNECTION'),
'queue' => env('TELESCOPE_QUEUE'),
'delay' => env('TELESCOPE_QUEUE_DELAY', 10),
],
/*
|--------------------------------------------------------------------------
| Telescope Route Middleware
|--------------------------------------------------------------------------
|
| These middleware will be assigned to every Telescope route, giving you
| the chance to add your own middleware to this list or change any of
| the existing middleware. Or, you can simply stick with this list.
|
*/
'middleware' => [
'web',
Authorize::class,
],
/*
|--------------------------------------------------------------------------
| Allowed / Ignored Paths & Commands
|--------------------------------------------------------------------------
|
| The following array lists the URI paths and Artisan commands that will
| not be watched by Telescope. In addition to this list, some Laravel
| commands, like migrations and queue commands, are always ignored.
|
*/
'only_paths' => [
// 'api/*'
],
'ignore_paths' => [
'livewire*',
'nova-api*',
'pulse*',
'_boost*',
'.well-known*',
],
'ignore_commands' => [
//
],
/*
|--------------------------------------------------------------------------
| Telescope Watchers
|--------------------------------------------------------------------------
|
| The following array lists the "watchers" that will be registered with
| Telescope. The watchers gather the application's profile data when
| a request or task is executed. Feel free to customize this list.
|
*/
'watchers' => [
Watchers\BatchWatcher::class => env('TELESCOPE_BATCH_WATCHER', true),
Watchers\CacheWatcher::class => [
'enabled' => env('TELESCOPE_CACHE_WATCHER', true),
'hidden' => [],
'ignore' => [],
],
Watchers\ClientRequestWatcher::class => [
'enabled' => env('TELESCOPE_CLIENT_REQUEST_WATCHER', true),
'ignore_hosts' => [],
],
Watchers\CommandWatcher::class => [
'enabled' => env('TELESCOPE_COMMAND_WATCHER', true),
'ignore' => [],
],
Watchers\DumpWatcher::class => [
'enabled' => env('TELESCOPE_DUMP_WATCHER', true),
'always' => env('TELESCOPE_DUMP_WATCHER_ALWAYS', false),
],
Watchers\EventWatcher::class => [
'enabled' => env('TELESCOPE_EVENT_WATCHER', true),
'ignore' => [],
],
Watchers\ExceptionWatcher::class => env('TELESCOPE_EXCEPTION_WATCHER', true),
Watchers\GateWatcher::class => [
'enabled' => env('TELESCOPE_GATE_WATCHER', true),
'ignore_abilities' => [],
'ignore_packages' => true,
'ignore_paths' => [],
],
Watchers\JobWatcher::class => env('TELESCOPE_JOB_WATCHER', true),
Watchers\LogWatcher::class => [
'enabled' => env('TELESCOPE_LOG_WATCHER', true),
'level' => 'error',
],
Watchers\MailWatcher::class => env('TELESCOPE_MAIL_WATCHER', true),
Watchers\ModelWatcher::class => [
'enabled' => env('TELESCOPE_MODEL_WATCHER', true),
'events' => ['eloquent.*'],
'hydrations' => true,
],
Watchers\NotificationWatcher::class => env('TELESCOPE_NOTIFICATION_WATCHER', true),
Watchers\QueryWatcher::class => [
'enabled' => env('TELESCOPE_QUERY_WATCHER', true),
'ignore_packages' => true,
'ignore_paths' => [],
'slow' => 100,
],
Watchers\RedisWatcher::class => env('TELESCOPE_REDIS_WATCHER', true),
Watchers\RequestWatcher::class => [
'enabled' => env('TELESCOPE_REQUEST_WATCHER', true),
'size_limit' => env('TELESCOPE_RESPONSE_SIZE_LIMIT', 64),
'ignore_http_methods' => [],
'ignore_status_codes' => [],
],
Watchers\ScheduleWatcher::class => env('TELESCOPE_SCHEDULE_WATCHER', true),
Watchers\ViewWatcher::class => env('TELESCOPE_VIEW_WATCHER', true),
],
];
@@ -0,0 +1,70 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Get the migration connection name.
*/
public function getConnection(): ?string
{
return config('telescope.storage.database.connection');
}
/**
* Run the migrations.
*/
public function up(): void
{
$schema = Schema::connection($this->getConnection());
$schema->create('telescope_entries', function (Blueprint $table) {
$table->bigIncrements('sequence');
$table->uuid('uuid');
$table->uuid('batch_id');
$table->string('family_hash')->nullable();
$table->boolean('should_display_on_index')->default(true);
$table->string('type', 20);
$table->longText('content');
$table->dateTime('created_at')->nullable();
$table->unique('uuid');
$table->index('batch_id');
$table->index('family_hash');
$table->index('created_at');
$table->index(['type', 'should_display_on_index']);
});
$schema->create('telescope_entries_tags', function (Blueprint $table) {
$table->uuid('entry_uuid');
$table->string('tag');
$table->primary(['entry_uuid', 'tag']);
$table->index('tag');
$table->foreign('entry_uuid')
->references('uuid')
->on('telescope_entries')
->cascadeOnDelete();
});
$schema->create('telescope_monitoring', function (Blueprint $table) {
$table->string('tag')->primary();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
$schema = Schema::connection($this->getConnection());
$schema->dropIfExists('telescope_entries_tags');
$schema->dropIfExists('telescope_entries');
$schema->dropIfExists('telescope_monitoring');
}
};
@@ -0,0 +1,70 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Get the migration connection name.
*/
public function getConnection(): ?string
{
return config('telescope.storage.database.connection');
}
/**
* Run the migrations.
*/
public function up(): void
{
$schema = Schema::connection($this->getConnection());
$schema->create('telescope_entries', function (Blueprint $table) {
$table->bigIncrements('sequence');
$table->uuid('uuid');
$table->uuid('batch_id');
$table->string('family_hash')->nullable();
$table->boolean('should_display_on_index')->default(true);
$table->string('type', 20);
$table->longText('content');
$table->dateTime('created_at')->nullable();
$table->unique('uuid');
$table->index('batch_id');
$table->index('family_hash');
$table->index('created_at');
$table->index(['type', 'should_display_on_index']);
});
$schema->create('telescope_entries_tags', function (Blueprint $table) {
$table->uuid('entry_uuid');
$table->string('tag');
$table->primary(['entry_uuid', 'tag']);
$table->index('tag');
$table->foreign('entry_uuid')
->references('uuid')
->on('telescope_entries')
->cascadeOnDelete();
});
$schema->create('telescope_monitoring', function (Blueprint $table) {
$table->string('tag')->primary();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
$schema = Schema::connection($this->getConnection());
$schema->dropIfExists('telescope_entries_tags');
$schema->dropIfExists('telescope_entries');
$schema->dropIfExists('telescope_monitoring');
}
};