feat: remove EventProductType references and related logic from catalog and fiesta futbol infantil components
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -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]);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Domains\Catalog\Enums\EventProductType;
|
||||
use App\Domains\Catalog\Enums\FeaturedGroupSource;
|
||||
use App\Domains\Catalog\Enums\GroupLayout;
|
||||
use App\Domains\Catalog\Enums\InventoryPolicy;
|
||||
@@ -109,7 +108,6 @@ class FiestaFutbolInfantilProductSeeder extends Seeder
|
||||
'nombre' => 'Abono',
|
||||
'category_id' => $categories['entradas']->id,
|
||||
'precio' => 40000,
|
||||
'event_product_type' => EventProductType::Entry->value,
|
||||
'has_tickets' => true,
|
||||
'attribute_codes' => ['event_date'],
|
||||
'multi_select_attribute_codes' => ['event_date'],
|
||||
@@ -143,7 +141,6 @@ class FiestaFutbolInfantilProductSeeder extends Seeder
|
||||
{
|
||||
return $this->catalogService->create([
|
||||
'tenant_code' => $tenant->codigo,
|
||||
'event_product_type' => EventProductType::Product->value,
|
||||
'descripcion' => $data['nombre'],
|
||||
'inventory_policy' => InventoryPolicy::Unlimited->value,
|
||||
...$data,
|
||||
|
||||
Reference in New Issue
Block a user