feat(desfile): associate tickets menu with desfile tenant and add migration test
This commit is contained in:
@@ -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();
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user