feat(menu): update contact menu to dynamic content type and preserve legacy data for rollback
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::table('menues')->where('code', 'help.contact')->update([
|
||||
'content_type' => 'dynamic',
|
||||
'static_content_schema' => null,
|
||||
]);
|
||||
// Preserve legacy pivot content for rollback; dynamic menus do not expose it.
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
DB::table('menues')->where('code', 'help.contact')->update([
|
||||
'content_type' => 'static',
|
||||
'static_content_schema' => json_encode([
|
||||
'whatsapp' => 'required|array',
|
||||
'whatsapp.whatsapp_url' => 'required|url',
|
||||
'whatsapp.whatsapp_label' => 'required|string',
|
||||
'phone' => 'required|string',
|
||||
'locations' => 'required|array|min:1',
|
||||
'locations.*.label' => 'required|string',
|
||||
'locations.*.addresses' => 'required|array|min:1',
|
||||
'locations.*.addresses.*' => 'required|array:label,address,coordinates',
|
||||
'locations.*.addresses.*.label' => 'required|string',
|
||||
'locations.*.addresses.*.address' => 'required|string',
|
||||
'locations.*.addresses.*.coordinates' => 'required|array|size:2',
|
||||
'locations.*.addresses.*.coordinates.0' => 'required|numeric|between:-90,90',
|
||||
'locations.*.addresses.*.coordinates.1' => 'required|numeric|between:-180,180',
|
||||
'map_locations' => 'prohibited',
|
||||
], JSON_THROW_ON_ERROR),
|
||||
]);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user