feat: remove EventProductType references and related logic from catalog and fiesta futbol infantil components

This commit is contained in:
2026-08-10 16:37:28 -03:00
parent 5bfc8b9f70
commit 69320c54d4
21 changed files with 90 additions and 79 deletions

View File

@@ -1,6 +1,5 @@
<?php
use App\Domains\Catalog\Enums\EventProductType;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
@@ -43,9 +42,6 @@ return new class extends Migration
->after('tenant_code')
->constrained('events')
->nullOnDelete();
$table->enum('event_product_type', EventProductType::values())
->nullable()
->after('event_id');
});
Schema::table('variantes', function (Blueprint $table): void {
@@ -71,7 +67,6 @@ return new class extends Migration
Schema::table('catalog_items', function (Blueprint $table): void {
$table->dropConstrainedForeignId('event_id');
$table->dropColumn('event_product_type');
});
Schema::dropIfExists('event_dates');

View File

@@ -14,9 +14,14 @@ return new class extends Migration
public function down(): void
{
$entryCategoryIds = DB::table('categorias')
->select('id')
->where('tenant_code', 'fiesta_futbol_infantil')
->where('nombre', 'Entradas');
DB::table('catalog_items')
->where('tenant_code', 'fiesta_futbol_infantil')
->where('event_product_type', 'producto')
->whereNotIn('category_id', $entryCategoryIds)
->update(['has_tickets' => false]);
}
};

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
if (! Schema::hasColumn('catalog_items', 'event_product_type')) {
return;
}
Schema::table('catalog_items', function (Blueprint $table): void {
$table->dropColumn('event_product_type');
});
}
public function down(): void
{
if (Schema::hasColumn('catalog_items', 'event_product_type')) {
return;
}
Schema::table('catalog_items', function (Blueprint $table): void {
$table->enum('event_product_type', ['entrada', 'producto'])
->nullable()
->after('tenant_code');
});
}
};