Offline-tolerant music-video merge

The merge no longer refuses when NAS is unreachable. DB changes always
run; per-side file operations are best-effort. When the NAS rename can't
happen it's recorded in a new pending_nas_moves table, and nas:auto-sync
drains the queue (rename + best-effort parent prune) once NAS is back,
retaining attempts/last_error on failure. Also plugs missing isEnabled()
guards on renameNasPath and deleteFolder so the merge cleanup path can't
hang on smbclient timeouts.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This commit is contained in:
ghassanandClaude Opus 4.7 committed 2026-07-31 03:27:52 +03:00
1 parent fcb752dd76
commit 847020fd02
4 files changed
+101 -12

No files matched your search

@@ -0,0 +1,33 @@
<?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
{
// Records file/folder moves that were queued while NAS was
// unreachable. `nas:auto-sync` drains rows when NAS is back:
// for each row it renames from → to on NAS and deletes the row.
Schema::create('pending_nas_moves', function (Blueprint $table) {
$table->id();
$table->string('from_path', 500);
$table->string('to_path', 500);
$table->string('kind', 24)->default('folder'); // 'folder' or 'file'
$table->string('origin', 40)->default('merge'); // where it came from
$table->unsignedInteger('attempts')->default(0);
$table->timestamp('last_attempt_at')->nullable();
$table->text('last_error')->nullable();
$table->timestamps();
$table->index(['origin', 'created_at']);
});
}
public function down(): void
{
Schema::dropIfExists('pending_nas_moves');
}
};