diff --git a/backend/migrations/2025_11_13_068522_create_skus_mapping.php b/backend/migrations/2025_11_13_068522_create_skus_mapping.php index b3e52ec..a547394 100644 --- a/backend/migrations/2025_11_13_068522_create_skus_mapping.php +++ b/backend/migrations/2025_11_13_068522_create_skus_mapping.php @@ -30,8 +30,9 @@ return new class extends Migration $table->text('note')->nullable()->default(null)->comment('备注信息'); $table->timestampsTz(); - // 创建联合唯一索引 - $table->unique(['platform_id', 'platform_product_id', 'origin_sku'], 'uk_platform_product_origin'); + // 创建联合唯一索引:确保同一平台的同一产品只能有一条映射记录 + // 原始 SKU 的约束由业务侧实现 + $table->unique(['platform_id', 'platform_product_id'], 'uk_platform_product'); }); }