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 427652327e
commit e9614b7a43
2 changed files with 34 additions and 0 deletions

View file

@ -1,5 +1,9 @@
# Flexisip Account Manager Changelog
v1.6.8
---
- Fix FLEXIAPI-375 Fix VcardsStorage table UUID size, recover the UUID from the stored vCard
v1.6.7
---
- Fix FLEXIAPI-367 Bump laravel-redis-sentinel dependency to support Redis 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();
});
}
};