Rework TIC processing to use Storage::disk(). Implemented handling of replaces and files that already exist

This commit is contained in:
2023-09-23 22:01:18 +10:00
parent 56544b89e1
commit ff04de52b5
10 changed files with 199 additions and 105 deletions

View File

@@ -0,0 +1,34 @@
<?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('files', function (Blueprint $table) {
$table->dropUnique(['filearea_id','name']);
$table->string('replaces')->nullable();
});
DB::statement("CREATE UNIQUE INDEX files_active ON files (filearea_id, name) WHERE deleted_at IS NULL");
}
/**
* Reverse the migrations.
*/
public function down(): void
{
DB::statement("DROP INDEX files_active");
Schema::table('files', function (Blueprint $table) {
$table->unique(['filearea_id','name']);
$table->dropColumn('replaces');
});
}
};