diff --git a/database/migrations/2025_04_14_091509_create_catalogue_products_table.php b/database/migrations/2025_04_14_091509_create_catalogue_products_table.php index a986895..3c18a43 100644 --- a/database/migrations/2025_04_14_091509_create_catalogue_products_table.php +++ b/database/migrations/2025_04_14_091509_create_catalogue_products_table.php @@ -8,7 +8,7 @@ { public function up(): void { - Schema::create('catalogue_products', function (Blueprint $table) { + Schema::create('pim_products', function (Blueprint $table) { $table->id(); $table->string('code')->nullable(); $table->string('barcode')->nullable(); @@ -26,6 +26,6 @@ public function up(): void public function down(): void { - Schema::dropIfExists('catalogue_products'); + Schema::dropIfExists('pim_products'); } }; diff --git a/database/migrations/2025_07_01_141618_create_categories_table.php b/database/migrations/2025_07_01_141618_create_categories_table.php index 2013602..c2fb5c6 100644 --- a/database/migrations/2025_07_01_141618_create_categories_table.php +++ b/database/migrations/2025_07_01_141618_create_categories_table.php @@ -8,7 +8,7 @@ { public function up(): void { - Schema::create('catalogue_categories', function (Blueprint $table) { + Schema::create('pim_categories', function (Blueprint $table) { $table->id(); $table->foreignId('site_id') ->constrained() @@ -31,6 +31,6 @@ public function up(): void public function down(): void { - Schema::dropIfExists('catalogue_categories'); + Schema::dropIfExists('pim_categories'); } }; diff --git a/database/migrations/2025_07_09_091509_add_category_to_catalogue_products_table.php b/database/migrations/2025_07_09_091509_add_category_to_catalogue_products_table.php index c4a689a..94d06da 100644 --- a/database/migrations/2025_07_09_091509_add_category_to_catalogue_products_table.php +++ b/database/migrations/2025_07_09_091509_add_category_to_catalogue_products_table.php @@ -8,11 +8,11 @@ { public function up(): void { - Schema::table('catalogue_products', function (Blueprint $table) { + Schema::table('pim_products', function (Blueprint $table) { $table->foreignId('category_id') ->nullable() ->after('name') - ->constrained('catalogue_categories') + ->constrained('pim_categories') ->nullOnDelete() ->cascadeOnUpdate(); }); @@ -20,7 +20,7 @@ public function up(): void public function down(): void { - Schema::table('catalogue_products', function (Blueprint $table) { + Schema::table('pim_products', function (Blueprint $table) { $table->dropForeign(['category_id']); $table->dropColumn('category_id'); }); diff --git a/database/migrations/2025_08_13_071152_add_product_type_id_to_catalogue_products_table.php b/database/migrations/2025_08_13_071152_add_product_type_id_to_catalogue_products_table.php index 50009e2..e5b795b 100644 --- a/database/migrations/2025_08_13_071152_add_product_type_id_to_catalogue_products_table.php +++ b/database/migrations/2025_08_13_071152_add_product_type_id_to_catalogue_products_table.php @@ -8,7 +8,7 @@ { public function up(): void { - Schema::table('catalogue_products', function (Blueprint $table) { + Schema::table('pim_products', function (Blueprint $table) { $table->foreignId('product_type_id') ->nullable() ->after('category_id') @@ -20,7 +20,7 @@ public function up(): void public function down(): void { - Schema::table('catalogue_products', function (Blueprint $table) { + Schema::table('pim_products', function (Blueprint $table) { $table->dropForeign(['product_type_id']); $table->dropColumn('product_type_id'); }); diff --git a/database/migrations/2025_08_16_121410_create_product_data_table.php b/database/migrations/2025_08_16_121410_create_product_data_table.php index 6fe734f..4302d0e 100644 --- a/database/migrations/2025_08_16_121410_create_product_data_table.php +++ b/database/migrations/2025_08_16_121410_create_product_data_table.php @@ -8,7 +8,7 @@ { public function up(): void { - Schema::create('catalogue_product_data', function (Blueprint $table) { + Schema::create('pim_product_data', function (Blueprint $table) { $table->id(); $table->foreignId('product_id'); @@ -32,6 +32,6 @@ public function up(): void public function down(): void { - Schema::dropIfExists('catalogue_product_data'); + Schema::dropIfExists('pim_product_data'); } }; diff --git a/database/migrations/2025_08_16_121654_add_product_attributes.php b/database/migrations/2025_08_16_121654_add_product_attributes.php index f4e4559..899787d 100644 --- a/database/migrations/2025_08_16_121654_add_product_attributes.php +++ b/database/migrations/2025_08_16_121654_add_product_attributes.php @@ -8,7 +8,7 @@ { public function up(): void { - Schema::table('catalogue_products', function (Blueprint $table) { + Schema::table('pim_products', function (Blueprint $table) { $table->string('origin_country_id', 2)->nullable(); $table->foreign('origin_country_id') ->references('id') @@ -24,7 +24,7 @@ public function up(): void public function down(): void { - Schema::table('catalogue_products', function (Blueprint $table) { + Schema::table('pim_products', function (Blueprint $table) { $table->dropForeign(['origin_country_id']); $table->dropColumn([ 'origin_country_id', diff --git a/database/migrations/2025_08_18_104934_create_catalogue_product_prices_table.php b/database/migrations/2025_08_18_104934_create_catalogue_product_prices_table.php index c7db836..c7cba60 100644 --- a/database/migrations/2025_08_18_104934_create_catalogue_product_prices_table.php +++ b/database/migrations/2025_08_18_104934_create_catalogue_product_prices_table.php @@ -11,10 +11,10 @@ */ public function up(): void { - Schema::create('catalogue_product_prices', function (Blueprint $table) { + Schema::create('pim_product_prices', function (Blueprint $table) { $table->id(); $table->foreignId('product_id') - ->constrained('catalogue_products') + ->constrained('pim_products') ->cascadeOnUpdate() ->cascadeOnDelete(); $table->foreignId('price_list_id') @@ -35,6 +35,6 @@ public function up(): void */ public function down(): void { - Schema::dropIfExists('catalogue_product_prices'); + Schema::dropIfExists('pim_product_prices'); } }; diff --git a/database/migrations/2025_08_19_110136_move_product_category_id_to_product_data_table.php b/database/migrations/2025_08_19_110136_move_product_category_id_to_product_data_table.php index adc2d4b..f57d309 100644 --- a/database/migrations/2025_08_19_110136_move_product_category_id_to_product_data_table.php +++ b/database/migrations/2025_08_19_110136_move_product_category_id_to_product_data_table.php @@ -11,13 +11,13 @@ */ public function up(): void { - Schema::table('catalogue_product_data', function (Blueprint $table) { + Schema::table('pim_product_data', function (Blueprint $table) { $table->foreignId('category_id')->nullable()->after('product_id') - ->constrained('catalogue_categories') + ->constrained('pim_categories') ->cascadeOnUpdate() ->nullOnDelete(); }); - Schema::table('catalogue_products', function (Blueprint $table) { + Schema::table('pim_products', function (Blueprint $table) { $table->dropConstrainedForeignId('category_id'); }); } @@ -27,13 +27,13 @@ public function up(): void */ public function down(): void { - Schema::table('catalogue_products', function (Blueprint $table) { + Schema::table('pim_products', function (Blueprint $table) { $table->foreignId('category_id')->nullable()->after('name') - ->constrained('catalogue_categories') + ->constrained('pim_categories') ->cascadeOnUpdate() ->nullOnDelete(); }); - Schema::table('catalogue_product_data', function (Blueprint $table) { + Schema::table('pim_product_data', function (Blueprint $table) { $table->dropConstrainedForeignId('category_id'); }); } diff --git a/database/migrations/2025_08_19_175623_create_catalogue_product_has_property_value_table.php b/database/migrations/2025_08_19_175623_create_catalogue_product_has_property_value_table.php index c5675f9..3ccf3e3 100644 --- a/database/migrations/2025_08_19_175623_create_catalogue_product_has_property_value_table.php +++ b/database/migrations/2025_08_19_175623_create_catalogue_product_has_property_value_table.php @@ -11,8 +11,8 @@ */ public function up(): void { - Schema::create('catalogue_product_has_property_value', function (Blueprint $table) { - $table->foreignId('product_id')->constrained('catalogue_products')->onDelete('cascade')->onUpdate('cascade'); + Schema::create('pim_product_has_property_value', function (Blueprint $table) { + $table->foreignId('product_id')->constrained('pim_products')->onDelete('cascade')->onUpdate('cascade'); $table->foreignId('property_value_id')->constrained('pim_property_value')->onDelete('cascade')->onUpdate('cascade'); $table->timestamps(); $table->unique(['product_id', 'property_value_id'], 'product_property_value_unique'); @@ -24,6 +24,6 @@ public function up(): void */ public function down(): void { - Schema::dropIfExists('catalogue_product_has_property_value'); + Schema::dropIfExists('pim_product_has_property_value'); } }; diff --git a/database/migrations/2025_08_23_223125_create_pim_group_has_product_table.php b/database/migrations/2025_08_23_223125_create_pim_group_has_product_table.php index 4adf303..60a388f 100644 --- a/database/migrations/2025_08_23_223125_create_pim_group_has_product_table.php +++ b/database/migrations/2025_08_23_223125_create_pim_group_has_product_table.php @@ -10,7 +10,7 @@ public function up(): void { Schema::create('pim_group_has_product', function (Blueprint $table) { $table->foreignId('product_id') - ->constrained('catalogue_products', 'id') + ->constrained('pim_products', 'id') ->cascadeOnUpdate() ->cascadeOnDelete(); diff --git a/database/migrations/2025_08_26_173948_add_tariff_code_to_products_table.php b/database/migrations/2025_08_26_173948_add_tariff_code_to_products_table.php index 161f458..c083a82 100644 --- a/database/migrations/2025_08_26_173948_add_tariff_code_to_products_table.php +++ b/database/migrations/2025_08_26_173948_add_tariff_code_to_products_table.php @@ -8,14 +8,14 @@ { public function up(): void { - Schema::table('catalogue_products', function (Blueprint $table) { + Schema::table('pim_products', function (Blueprint $table) { $table->foreignId('tariff_code_id')->nullable()->after('origin_country_id')->constrained('world_tariff_codes')->cascadeOnUpdate()->cascadeOnDelete(); }); } public function down(): void { - Schema::table('catalogue_products', function (Blueprint $table) { + Schema::table('pim_products', function (Blueprint $table) { $table->dropForeign(['tariff_code_id']); $table->dropColumn('tariff_code_id'); }); diff --git a/database/migrations/2025_08_29_134419_create_catalogue_product_has_custom_prop_value_table.php b/database/migrations/2025_08_29_134419_create_catalogue_product_has_custom_prop_value_table.php index 44d395b..e50f79c 100644 --- a/database/migrations/2025_08_29_134419_create_catalogue_product_has_custom_prop_value_table.php +++ b/database/migrations/2025_08_29_134419_create_catalogue_product_has_custom_prop_value_table.php @@ -11,9 +11,9 @@ */ public function up(): void { - Schema::create('catalogue_product_has_custom_prop_value', function (Blueprint $table) { + Schema::create('pim_product_has_custom_prop_value', function (Blueprint $table) { $table->id(); - $table->foreignId('product_id')->constrained('catalogue_products')->onDelete('cascade')->onUpdate('cascade'); + $table->foreignId('product_id')->constrained('pim_products')->onDelete('cascade')->onUpdate('cascade'); $table->foreignId('property_id')->constrained('pim_property')->onDelete('cascade')->onUpdate('cascade'); $table->text('value'); $table->timestamps(); @@ -26,6 +26,6 @@ public function up(): void */ public function down(): void { - Schema::dropIfExists('catalogue_product_has_custom_prop_value'); + Schema::dropIfExists('pim_product_has_custom_prop_value'); } }; diff --git a/database/migrations/2025_09_09_185915_add_product_status_id_to_catalogue_product_data_table.php b/database/migrations/2025_09_09_185915_add_product_status_id_to_catalogue_product_data_table.php index 6a924c3..7808f02 100644 --- a/database/migrations/2025_09_09_185915_add_product_status_id_to_catalogue_product_data_table.php +++ b/database/migrations/2025_09_09_185915_add_product_status_id_to_catalogue_product_data_table.php @@ -8,7 +8,7 @@ { public function up(): void { - Schema::table('catalogue_product_data', function (Blueprint $table) { + Schema::table('pim_product_data', function (Blueprint $table) { $table->foreignId('product_status_id') ->nullable() ->after('product_id') @@ -20,7 +20,7 @@ public function up(): void public function down(): void { - Schema::table('catalogue_product_data', function (Blueprint $table) { + Schema::table('pim_product_data', function (Blueprint $table) { $table->dropForeign(['product_status_id']); $table->dropColumn('product_status_id'); }); diff --git a/src/Filament/Resources/GroupResource/RelationManagers/ProductsRelationManager.php b/src/Filament/Resources/GroupResource/RelationManagers/ProductsRelationManager.php index 7ce11ad..9e6ab53 100644 --- a/src/Filament/Resources/GroupResource/RelationManagers/ProductsRelationManager.php +++ b/src/Filament/Resources/GroupResource/RelationManagers/ProductsRelationManager.php @@ -60,8 +60,8 @@ public function table(Table $table): Table } // Exclude products already in this group - $existingProductIds = $group->products()->pluck('catalogue_products.id')->toArray(); - $query->whereNotIn('catalogue_products.id', $existingProductIds); + $existingProductIds = $group->products()->pluck('pim_products.id')->toArray(); + $query->whereNotIn('pim_products.id', $existingProductIds); return $query->pluck('name', 'id')->toArray(); }) @@ -135,7 +135,7 @@ public function table(Table $table): Table $refName = $livewire->getOwnerRecord() ->products() - ->where('catalogue_products.id', $refId) + ->where('pim_products.id', $refId) ->value('name'); if (! $refName) { @@ -155,7 +155,7 @@ public function table(Table $table): Table $group = $this->getOwnerRecord(); $reference = $group->products() - ->where('catalogue_products.id', $data['reference_id']) + ->where('pim_products.id', $data['reference_id']) ->firstOrFail(); if ($data['position'] === 'before') { diff --git a/src/Models/Category.php b/src/Models/Category.php index 7b119dc..78ca4f5 100644 --- a/src/Models/Category.php +++ b/src/Models/Category.php @@ -17,7 +17,7 @@ class Category extends Model { use HasFactory, HasTranslations, IsSearchable, ModelTree, SoftDeletes; - protected $table = 'catalogue_categories'; + protected $table = 'pim_categories'; protected $fillable = [ 'name', diff --git a/src/Models/CustomPropertyValue.php b/src/Models/CustomPropertyValue.php index f9938b6..208bab1 100644 --- a/src/Models/CustomPropertyValue.php +++ b/src/Models/CustomPropertyValue.php @@ -8,7 +8,7 @@ class CustomPropertyValue extends Model { - protected $table = 'catalogue_product_has_custom_prop_value'; + protected $table = 'pim_product_has_custom_prop_value'; protected $fillable = [ 'product_id', diff --git a/src/Models/Product.php b/src/Models/Product.php index 2076851..6e03dd8 100644 --- a/src/Models/Product.php +++ b/src/Models/Product.php @@ -22,7 +22,7 @@ class Product extends Model implements HasMedia { use HasFactory, HasTenantScopedData, HasTranslations, InteractsWithMedia, IsSearchable, SoftDeletes; - protected $table = 'catalogue_products'; + protected $table = 'pim_products'; protected $fillable = [ 'code', @@ -104,7 +104,7 @@ public function type(): BelongsTo public function propertyValues(): BelongsToMany { - return $this->belongsToMany(PropertyValue::class, 'catalogue_product_has_property_value', 'product_id', 'property_value_id') + return $this->belongsToMany(PropertyValue::class, 'pim_product_has_property_value', 'product_id', 'property_value_id') ->withTimestamps(); } @@ -115,7 +115,7 @@ public function customPropertyValues(): HasMany public function customProperties(): BelongsToMany { - return $this->belongsToMany(Property::class, 'catalogue_product_has_custom_prop_value', 'product_id', 'property_id') + return $this->belongsToMany(Property::class, 'pim_product_has_custom_prop_value', 'product_id', 'property_id') ->withPivot('value') ->withTimestamps(); } diff --git a/src/Models/Product/Price.php b/src/Models/Product/Price.php index ad2a5e3..acf69f8 100644 --- a/src/Models/Product/Price.php +++ b/src/Models/Product/Price.php @@ -9,7 +9,7 @@ class Price extends Model { - protected $table = 'catalogue_product_prices'; + protected $table = 'pim_product_prices'; protected $fillable = [ 'id', diff --git a/src/Models/ProductData.php b/src/Models/ProductData.php index d4a4148..8c98bea 100644 --- a/src/Models/ProductData.php +++ b/src/Models/ProductData.php @@ -10,7 +10,7 @@ class ProductData extends Model { use HasFactory; - protected $table = 'catalogue_product_data'; + protected $table = 'pim_product_data'; public $timestamps = false; diff --git a/src/Models/PropertyValue.php b/src/Models/PropertyValue.php index 2081e1e..0dc801b 100644 --- a/src/Models/PropertyValue.php +++ b/src/Models/PropertyValue.php @@ -47,7 +47,7 @@ public function property(): BelongsTo public function products(): BelongsToMany { - return $this->belongsToMany(Product::class, 'catalogue_product_has_property_value', 'property_value_id', 'product_id') + return $this->belongsToMany(Product::class, 'pim_product_has_property_value', 'property_value_id', 'product_id') ->withTimestamps(); } @@ -141,7 +141,7 @@ public function mergeInto(int $targetId): array throw new \RuntimeException('Values must belong to the same property.'); } - $pivotTable = 'catalogue_product_has_property_value'; + $pivotTable = 'pim_product_has_property_value'; $productIds = DB::table($pivotTable) ->where('property_value_id', $this->id) diff --git a/tests/Feature/CustomPropertyMultilangTest.php b/tests/Feature/CustomPropertyMultilangTest.php index b407725..21ccb9b 100644 --- a/tests/Feature/CustomPropertyMultilangTest.php +++ b/tests/Feature/CustomPropertyMultilangTest.php @@ -181,7 +181,7 @@ $product->setCustomPropertyValue($property, $multilangValue); // Verify the value is stored as JSON in the database - $this->assertDatabaseHas('catalogue_product_has_custom_prop_value', [ + $this->assertDatabaseHas('pim_product_has_custom_prop_value', [ 'product_id' => $product->id, 'property_id' => $property->id, 'value' => json_encode($multilangValue), diff --git a/tests/Feature/InlineTranslatableFieldTest.php b/tests/Feature/InlineTranslatableFieldTest.php index 0a727c5..2afd5e8 100644 --- a/tests/Feature/InlineTranslatableFieldTest.php +++ b/tests/Feature/InlineTranslatableFieldTest.php @@ -156,7 +156,7 @@ $product->setCustomPropertyValue($property, $multilangValue); // Verify the value is stored as JSON in the database - $this->assertDatabaseHas('catalogue_product_has_custom_prop_value', [ + $this->assertDatabaseHas('pim_product_has_custom_prop_value', [ 'product_id' => $product->id, 'property_id' => $property->id, 'value' => json_encode($multilangValue), diff --git a/tests/Feature/PropertyIntegrationTest.php b/tests/Feature/PropertyIntegrationTest.php index e61238b..55588e8 100644 --- a/tests/Feature/PropertyIntegrationTest.php +++ b/tests/Feature/PropertyIntegrationTest.php @@ -96,12 +96,12 @@ expect($product->propertyValues->pluck('id')->toArray())->toContain($value1->id); expect($product->propertyValues->pluck('id')->toArray())->toContain($value2->id); - $this->assertDatabaseHas('catalogue_product_has_property_value', [ + $this->assertDatabaseHas('pim_product_has_property_value', [ 'product_id' => $product->id, 'property_value_id' => $value1->id, ]); - $this->assertDatabaseHas('catalogue_product_has_property_value', [ + $this->assertDatabaseHas('pim_product_has_property_value', [ 'product_id' => $product->id, 'property_value_id' => $value2->id, ]); diff --git a/tests/Feature/PropertyValueMergeTest.php b/tests/Feature/PropertyValueMergeTest.php index c2f8420..4011019 100644 --- a/tests/Feature/PropertyValueMergeTest.php +++ b/tests/Feature/PropertyValueMergeTest.php @@ -48,7 +48,7 @@ $source->mergeInto($target->id); - $count = DB::table('catalogue_product_has_property_value') + $count = DB::table('pim_product_has_property_value') ->where('product_id', $product->id) ->where('property_value_id', $target->id) ->count(); @@ -73,7 +73,7 @@ // Ensure source still exists and link remains expect(PropertyValue::query()->whereKey($source->id)->exists())->toBeTrue(); - $links = DB::table('catalogue_product_has_property_value') + $links = DB::table('pim_product_has_property_value') ->where('product_id', $product->id) ->where('property_value_id', $source->id) ->count();