Fix FLEXIAPI-375 Fix VcardsStorage table UUID size, recover the UUID from the stored vCard

This commit is contained in:
Timothée Jaussoin 2025-08-27 16:29:47 +02:00
parent 740f603bbe
commit 7e9d34cf0b
2 changed files with 31 additions and 0 deletions

View file

@ -73,6 +73,7 @@ v2.0
- Fix FLEXIAPI-364 Fix a faulty redirection in the ExternalAccount controller
- Fix FLEXIAPI-361 Prepare the 2.0 release
- Fix FLEXIAPI-372 Remove SESSION_DRIVER and CACHE_DRIVER and enforce them to file
- Fix FLEXIAPI-375 Fix VcardsStorage table UUID size, recover the UUID from the stored vCard
v1.6
----

View file

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use App\VcardStorage;
use Sabre\VObject;
return new class extends Migration
{
public function up(): void
{
Schema::table('vcards_storage', function (Blueprint $table) {
$table->string('uuid', 45)->change();
});
foreach (VcardStorage::all() as $vcardStorage) {
$vcard = VObject\Reader::read($vcardStorage->vcard);
$vcardStorage->uuid = $vcard->UID;
$vcardStorage->save();
}
}
public function down(): void
{
Schema::table('vcards_storage', function (Blueprint $table) {
$table->string('uuid', 36)->change();
});
}
};