diff --git a/packages/core/database/migrations/2024_12_07_142851_create_product_variants_table.php b/packages/core/database/migrations/2024_12_07_142851_create_product_variants_table.php index d8ee6c27..5bf07c04 100644 --- a/packages/core/database/migrations/2024_12_07_142851_create_product_variants_table.php +++ b/packages/core/database/migrations/2024_12_07_142851_create_product_variants_table.php @@ -29,7 +29,7 @@ public function up(): void Schema::create($this->getTableName('product_variants'), function (Blueprint $table): void { $this->addCommonFields($table); - $table->string('name'); + $table->string('name')->index(); $table->string('sku')->unique()->nullable(); $table->string('barcode')->unique()->nullable(); $table->string('ean')->unique()->nullable(); diff --git a/packages/core/src/Helpers/Migration.php b/packages/core/src/Helpers/Migration.php index f9b45951..d7e59910 100755 --- a/packages/core/src/Helpers/Migration.php +++ b/packages/core/src/Helpers/Migration.php @@ -77,8 +77,8 @@ public function addForeignKey(Blueprint $table, string $column, string $tableNam public function removeForeignKeyAndColumn(Blueprint $table, string $column): void { - $table->dropIndex([$column]); $table->dropForeign([$column]); + $table->dropIndex([$column]); $table->dropColumn($column); } }