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 e0a9b75923
commit ee2c9fed8f
2 changed files with 31 additions and 0 deletions

View file

@ -7,6 +7,7 @@ v2.1
- Fix FLEXIAPI-359 Add CardDav servers support in the spaces
- Fix FLEXIAPI-374 Improve CardDav credentials form
- Fix FLEXIAPI-376 Rename domain to realm in CardDav credentials
- Fix FLEXIAPI-375 Fix VcardsStorage table UUID size, recover the UUID from the stored vCard
v2.0
----

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();
});
}
};