add skus related table

This commit is contained in:
2025-11-13 16:27:32 +08:00
parent e3cc31b947
commit 49d4f280f3
3 changed files with 90 additions and 28 deletions
@@ -0,0 +1,46 @@
<?php
use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('skus_mapping', function (Blueprint $table) {
$table->comment('存储 业务侧 SKU 到 客户原始 SKU 的映射信息, 当平台绑定异常时使用');
$table->bigIncrements('id')->primary()->comment('主键');
$table->integer('company_id')->comment('公司 ID 与 Tools 保持一致');
$table->integer('platform_id')->comment('平台 ID 与 Tools 保持一致');
$table->text('platform_product_id')->comment('平台 商品 ID 与 电商平台 保持一致');
$table->text('origin_sku')->comment('客户侧匹配的 SKU 编码, 组合商品需要拆分');
$table->integer('store_id')->nullable()->comment('店铺 ID 与 Tools 保持一致, 建议填写以方便核对');
$table->integer('warehouse_id')->nullable()->comment('店铺绑定仓库 ID 与 Tools 保持一致,建议填写,建议填写以方便核对');
$table->boolean('enabled')->default(true)->comment('是否启用映射规则,默认为启用');
$table->text('note')->nullable()->default(null)->comment('备注信息');
$table->timestampsTz();
// 创建联合唯一索引
$table->unique(['platform_id', 'platform_product_id', 'origin_sku'], 'uk_platform_product_origin');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('skus_mapping');
}
};