Current state with latest updates
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('security_reports', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->string('status', 32)->default('completed');
|
||||
$table->timestamp('started_at')->nullable();
|
||||
$table->timestamp('finished_at')->nullable();
|
||||
|
||||
$table->unsignedInteger('composer_critical')->default(0);
|
||||
$table->unsignedInteger('composer_high')->default(0);
|
||||
$table->unsignedInteger('composer_medium')->default(0);
|
||||
$table->unsignedInteger('composer_low')->default(0);
|
||||
$table->unsignedInteger('composer_unknown')->default(0);
|
||||
|
||||
$table->unsignedInteger('npm_critical')->default(0);
|
||||
$table->unsignedInteger('npm_high')->default(0);
|
||||
$table->unsignedInteger('npm_moderate')->default(0);
|
||||
$table->unsignedInteger('npm_low')->default(0);
|
||||
$table->unsignedInteger('npm_info')->default(0);
|
||||
$table->unsignedInteger('npm_unknown')->default(0);
|
||||
|
||||
$table->unsignedInteger('total_critical')->default(0);
|
||||
$table->unsignedInteger('total_high')->default(0);
|
||||
$table->unsignedInteger('total_medium')->default(0);
|
||||
$table->unsignedInteger('total_low')->default(0);
|
||||
$table->unsignedInteger('total_unknown')->default(0);
|
||||
|
||||
$table->unsignedInteger('composer_outdated_count')->default(0);
|
||||
$table->unsignedInteger('npm_outdated_count')->default(0);
|
||||
|
||||
$table->json('summary')->nullable();
|
||||
$table->json('composer_audit')->nullable();
|
||||
$table->json('composer_outdated')->nullable();
|
||||
$table->json('npm_audit')->nullable();
|
||||
$table->json('npm_outdated')->nullable();
|
||||
|
||||
$table->longText('error_message')->nullable();
|
||||
|
||||
$table->string('triggered_by', 64)->nullable();
|
||||
$table->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
$table->index('status');
|
||||
$table->index('finished_at');
|
||||
$table->index(['total_critical', 'total_high']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('security_reports');
|
||||
}
|
||||
};
|
||||
+53
@@ -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
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('artworks', function (Blueprint $table): void {
|
||||
if (! Schema::hasColumn('artworks', 'featured_thumbnail_variants_json')) {
|
||||
$table->json('featured_thumbnail_variants_json')
|
||||
->nullable()
|
||||
->after('thumbnails_checked_at');
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('artworks', 'featured_thumbnails_checked_at')) {
|
||||
$table->timestamp('featured_thumbnails_checked_at')
|
||||
->nullable()
|
||||
->after('featured_thumbnail_variants_json');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('artworks', function (Blueprint $table): void {
|
||||
if (Schema::hasColumn('artworks', 'featured_thumbnails_checked_at')) {
|
||||
$table->index('featured_thumbnails_checked_at', 'artworks_featured_thumbnails_checked_idx');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('artworks', function (Blueprint $table): void {
|
||||
try {
|
||||
$table->dropIndex('artworks_featured_thumbnails_checked_idx');
|
||||
} catch (Throwable) {
|
||||
}
|
||||
|
||||
$columns = [];
|
||||
|
||||
foreach (['featured_thumbnail_variants_json', 'featured_thumbnails_checked_at'] as $column) {
|
||||
if (Schema::hasColumn('artworks', $column)) {
|
||||
$columns[] = $column;
|
||||
}
|
||||
}
|
||||
|
||||
if ($columns !== []) {
|
||||
$table->dropColumn($columns);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user