chore: commit current workspace changes
This commit is contained in:
@@ -126,6 +126,11 @@ return new class extends Migration
|
||||
*/
|
||||
private function indexExists(string $table, string $indexName): bool
|
||||
{
|
||||
if (DB::getDriverName() === 'sqlite') {
|
||||
return collect(DB::select("PRAGMA index_list('{$table}')"))
|
||||
->contains(static fn (object $row): bool => ($row->name ?? null) === $indexName);
|
||||
}
|
||||
|
||||
return count(DB::select(
|
||||
"SHOW INDEX FROM `{$table}` WHERE Key_name = ?",
|
||||
[$indexName]
|
||||
|
||||
@@ -15,6 +15,10 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if (Schema::getConnection()->getDriverName() === 'sqlite') {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('artworks', function (Blueprint $table) {
|
||||
$table->fullText(['title', 'description'], 'artworks_title_description_fulltext');
|
||||
});
|
||||
@@ -22,6 +26,10 @@ return new class extends Migration
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if (Schema::getConnection()->getDriverName() === 'sqlite') {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('artworks', function (Blueprint $table) {
|
||||
$table->dropFullText('artworks_title_description_fulltext');
|
||||
});
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?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
|
||||
{
|
||||
if (Schema::hasTable('auth_audit_logs')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::create('auth_audit_logs', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->string('event_type', 64);
|
||||
$table->string('identifier')->nullable();
|
||||
$table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->string('ip', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->string('status', 32);
|
||||
$table->string('reason', 64)->nullable();
|
||||
$table->json('metadata')->nullable();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
|
||||
$table->index('event_type');
|
||||
$table->index('identifier');
|
||||
$table->index('user_id');
|
||||
$table->index('ip');
|
||||
$table->index(['event_type', 'status']);
|
||||
$table->index('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('auth_audit_logs');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user