Skip to content

Commit 9b0fb13

Browse files
authored
[Chore] Removed bad json functions and squashed migrations (alexjustesen#1911)
1 parent a016684 commit 9b0fb13

11 files changed

+20
-375
lines changed

app/Actions/MigrateBadJsonResults.php

Lines changed: 0 additions & 106 deletions
This file was deleted.

app/Filament/Resources/ResultResource.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,16 @@
22

33
namespace App\Filament\Resources;
44

5-
use App\Actions\MigrateBadJsonResults;
65
use App\Enums\ResultStatus;
76
use App\Filament\Exports\ResultExporter;
87
use App\Filament\Resources\ResultResource\Pages;
98
use App\Helpers\Number;
109
use App\Jobs\TruncateResults;
1110
use App\Models\Result;
12-
use App\Settings\DataMigrationSettings;
1311
use Carbon\Carbon;
1412
use Filament\Forms;
1513
use Filament\Forms\Components\TextInput;
1614
use Filament\Forms\Form;
17-
use Filament\Notifications\Notification;
1815
use Filament\Resources\Resource;
1916
use Filament\Support\Enums\Alignment;
2017
use Filament\Tables;
@@ -156,8 +153,6 @@ public static function form(Form $form): Form
156153

157154
public static function table(Table $table): Table
158155
{
159-
$dataSettings = new DataMigrationSettings;
160-
161156
return $table
162157
->columns([
163158
Tables\Columns\TextColumn::make('id')
@@ -407,21 +402,6 @@ public static function table(Table $table): Table
407402
Tables\Actions\ExportAction::make()
408403
->exporter(ResultExporter::class)
409404
->fileName(fn (): string => 'results-'.now()->timestamp),
410-
Tables\Actions\Action::make('migrate')
411-
->action(function (): void {
412-
Notification::make()
413-
->title('Starting data migration...')
414-
->body('This can take a little bit depending how much data you have.')
415-
->warning()
416-
->sendToDatabase(Auth::user());
417-
418-
MigrateBadJsonResults::dispatch(Auth::user());
419-
})
420-
->hidden($dataSettings->bad_json_migrated)
421-
->requiresConfirmation()
422-
->modalHeading('Migrate History')
423-
->modalDescription(new HtmlString('<p>v0.16.0 archived the old <code>"results"</code> table, to migrate your history click the button below.</p><p>For more information read the <a href="#" target="_blank" rel="nofollow" class="underline">docs</a>.</p>'))
424-
->modalSubmitActionLabel('Yes, migrate it'),
425405
Tables\Actions\ActionGroup::make([
426406
Tables\Actions\Action::make('truncate')
427407
->action(fn () => TruncateResults::dispatch(Auth::user()))

app/Settings/DataMigrationSettings.php

Lines changed: 0 additions & 15 deletions
This file was deleted.

database/migrations/2014_10_12_000000_create_users_table.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<?php
22

3+
use App\Enums\UserRole;
4+
use App\Models\User;
35
use Illuminate\Database\Migrations\Migration;
46
use Illuminate\Database\Schema\Blueprint;
7+
use Illuminate\Support\Facades\Hash;
58
use Illuminate\Support\Facades\Schema;
69

710
return new class extends Migration
@@ -18,8 +21,17 @@ public function up(): void
1821
$table->timestamp('email_verified_at')->nullable();
1922
$table->string('password');
2023
$table->rememberToken();
24+
$table->string('role')->default('user');
2125
$table->timestamps();
2226
});
27+
28+
User::create([
29+
'name' => 'Admin',
30+
'email' => '[email protected]',
31+
'email_verified_at' => now(),
32+
'password' => Hash::make('password'),
33+
'role' => UserRole::Admin,
34+
]);
2335
}
2436

2537
/**

database/migrations/2022_08_31_202106_create_results_table.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,15 @@ public function up(): void
1313
{
1414
Schema::create('results', function (Blueprint $table) {
1515
$table->id();
16-
$table->float('ping', 8, 3);
17-
$table->unsignedBigInteger('download'); // will be stored in bytes
18-
$table->unsignedBigInteger('upload'); // will be stored in bytes
19-
$table->integer('server_id')->nullable();
20-
$table->string('server_host')->nullable();
21-
$table->string('server_name')->nullable();
22-
$table->string('url')->nullable();
16+
$table->string('service')->default('ookla');
17+
$table->float('ping', 8, 3)->nullable();
18+
$table->unsignedBigInteger('download')->nullable();
19+
$table->unsignedBigInteger('upload')->nullable();
20+
$table->text('comments')->nullable();
21+
$table->json('data')->nullable();
22+
$table->string('status');
2323
$table->boolean('scheduled')->default(false);
24-
$table->json('data'); // is a dump of the cli output in case we want more fields later
25-
$table->timestamp('created_at')
26-
->useCurrent();
24+
$table->timestamps();
2725
});
2826
}
2927

database/migrations/2022_09_27_212959_create_admin_user.php

Lines changed: 0 additions & 29 deletions
This file was deleted.

database/migrations/2023_01_12_135235_update_results_table.php

Lines changed: 0 additions & 31 deletions
This file was deleted.

database/migrations/2023_02_12_131620_add_comments_to_results_table.php

Lines changed: 0 additions & 26 deletions
This file was deleted.

database/migrations/2023_09_11_225054_add_role_to_users_table.php

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)