feat(desfile): associate tickets menu with desfile tenant and add migration test

This commit is contained in:
2026-09-25 11:15:52 -03:00
parent b309738222
commit 57d278336d
11 changed files with 421 additions and 11 deletions

View File

@@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
private const MENU_CODE = 'adminapp.tickets';
private const TENANT_CODE = 'desfile_pura_tendencia';
public function up(): void
{
if (
! DB::table('menues')->where('code', self::MENU_CODE)->exists()
|| ! DB::table('tenants')->where('codigo', self::TENANT_CODE)->exists()
) {
return;
}
$now = now();
DB::table('tenants_menues')->updateOrInsert(
[
'tenant_code' => self::TENANT_CODE,
'menu_code' => self::MENU_CODE,
],
[
'static_content' => null,
'created_at' => $now,
'updated_at' => $now,
],
);
}
public function down(): void
{
DB::table('tenants_menues')
->where('tenant_code', self::TENANT_CODE)
->where('menu_code', self::MENU_CODE)
->delete();
}
};