feat(migrations): add migration for grouping Pyme Rural tenants and updating client associations

This commit is contained in:
2026-09-21 09:35:40 -03:00
parent 9a14b8fbbd
commit 14c81fec1b
8 changed files with 490 additions and 11 deletions

View File

@@ -12,9 +12,9 @@ use App\Domains\Commerce\Catalog\Models\CatalogItem;
use App\Domains\Commerce\Catalog\Models\FeaturedGroup;
use App\Domains\Commerce\Catalog\Services\CatalogService;
use App\Domains\Core\Client\Models\Client;
use App\Domains\Ticketing\Desfile\Services\InvitationPurchaseProvisioner;
use App\Domains\Core\Tenant\Models\Tenant;
use App\Domains\Core\Tenant\Services\TenantService;
use App\Domains\Ticketing\Desfile\Services\InvitationPurchaseProvisioner;
use Illuminate\Database\Seeder;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\DB;
@@ -22,7 +22,7 @@ use RuntimeException;
class DesfilePuraTendenciaSeeder extends Seeder
{
private const ONTICKET_CLIENT_CODE = 'onticket';
private const PYME_RURAL_CLIENT_CODE = 'pyme_rural';
private const TENANT_CODE = 'desfile_pura_tendencia';
@@ -34,9 +34,9 @@ class DesfilePuraTendenciaSeeder extends Seeder
public function run(): void
{
$client = Client::query()->firstOrCreate(
['code' => self::ONTICKET_CLIENT_CODE],
['name' => 'OnTicket'],
$client = Client::query()->updateOrCreate(
['code' => self::PYME_RURAL_CLIENT_CODE],
['name' => 'Pyme Rural'],
);
$tenant = Tenant::query()->where('codigo', self::TENANT_CODE)->first();

View File

@@ -2,13 +2,13 @@
namespace Database\Seeders;
use App\Shared\Attachable\Models\Attachment;
use App\Shared\Attachable\Services\AttachmentService;
use App\Domains\Core\Client\Models\Client;
use App\Domains\Core\Tenant\Models\Tenant;
use App\Domains\Core\Tenant\Models\AdminWebsiteType;
use App\Domains\Core\Tenant\Models\Tenant;
use App\Domains\Core\Tenant\Services\TenantService;
use App\Domains\Core\Tenant\Services\WebsiteExtraService;
use App\Shared\Attachable\Models\Attachment;
use App\Shared\Attachable\Services\AttachmentService;
use Illuminate\Database\Seeder;
use Illuminate\Http\UploadedFile;
use RuntimeException;
@@ -18,6 +18,8 @@ class TenantSeeder extends Seeder
{
private const ONTICKET_CLIENT_CODE = 'onticket';
private const PYME_RURAL_CLIENT_CODE = 'pyme_rural';
private const SONDER_CLIENT_CODE = 'sonder';
private const SOCIAL_MEDIA = [
@@ -60,6 +62,11 @@ class TenantSeeder extends Seeder
['name' => 'OnTicket'],
);
$pymeRuralClient = Client::query()->updateOrCreate(
['code' => self::PYME_RURAL_CLIENT_CODE],
['name' => 'Pyme Rural'],
);
$onTicketType = AdminWebsiteType::query()->where('codigo', 'onticket')->firstOrFail();
$onTicketTenant = Tenant::query()->where('codigo', 'onticket')->first();
@@ -199,7 +206,7 @@ class TenantSeeder extends Seeder
->delete();
$this->tenantService->create([
'client_id' => $onTicketClient->id,
'client_id' => $pymeRuralClient->id,
'codigo' => 'fiesta_futbol_infantil',
'nombre' => 'Fiesta Fútbol Infantil',
'dominio' => $fiestaDomain,