Configured the removal of old files that were not attached to the model or were marked as deleted.

This commit is contained in:
2024-07-26 22:18:01 +05:00
parent dde792b97a
commit c84ed9f12b
10 changed files with 235 additions and 8 deletions

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('storage', function (Blueprint $table) {
$table->dropIndex(['morph_id']);
$table->index(['morph_id', 'updated_at']);
$table->index(['deleted_at']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('storage', function (Blueprint $table) {
$table->dropIndex(['morph_id', 'updated_at']);
$table->dropIndex(['deleted_at']);
$table->index(['morph_id']);
});
}
};