diff --git a/app/Models/ProductSku.php b/app/Models/ProductSku.php index eaefe3ae..ed0dc1fb 100644 --- a/app/Models/ProductSku.php +++ b/app/Models/ProductSku.php @@ -21,6 +21,5 @@ class ProductSku extends Model 'user_price' => Price::class, 'attrs' => JsonArray::class, 'is_sell' => 'bool', - 'is_recommend' => 'bool', ]; } diff --git a/app/Models/ProductSpu.php b/app/Models/ProductSpu.php index ea756ad1..5f6f8e0e 100644 --- a/app/Models/ProductSpu.php +++ b/app/Models/ProductSpu.php @@ -19,6 +19,5 @@ class ProductSpu extends Model 'user_price' => Price::class, 'attrs' => JsonArray::class, 'is_sell' => 'bool', - 'is_recommend' => 'bool', ]; } diff --git a/database/migrations/2021_11_22_110044_create_product_spus_table.php b/database/migrations/2021_11_22_110044_create_product_spus_table.php index e7d3e620..c9b07dfb 100644 --- a/database/migrations/2021_11_22_110044_create_product_spus_table.php +++ b/database/migrations/2021_11_22_110044_create_product_spus_table.php @@ -29,8 +29,9 @@ class CreateProductSpusTable extends Migration $table->integer('weight')->unsigned()->nullable()->comment('重量:g'); $table->json('attrs')->nullable()->comment('属性文本'); $table->tinyInteger('is_sell')->unsigned()->default(0)->comment('在售状态'); - $table->tinyInteger('is_recommend')->unsigned()->default(0)->comment('是否推荐'); $table->timestamps(); + + $table->index('category_id'); }); } diff --git a/database/migrations/2021_11_24_115822_create_product_spu_specs_table.php b/database/migrations/2021_11_24_115822_create_product_spu_specs_table.php index 9e8604d4..260cbae8 100644 --- a/database/migrations/2021_11_24_115822_create_product_spu_specs_table.php +++ b/database/migrations/2021_11_24_115822_create_product_spu_specs_table.php @@ -24,6 +24,8 @@ class CreateProductSpuSpecsTable extends Migration */ $table->json('items')->nullable()->comment('规格值'); $table->timestamps(); + + $table->index('product_spu_id'); }); } diff --git a/database/migrations/2021_11_24_120232_create_product_skus_table.php b/database/migrations/2021_11_24_120232_create_product_skus_table.php index 5da63adb..992b4acd 100644 --- a/database/migrations/2021_11_24_120232_create_product_skus_table.php +++ b/database/migrations/2021_11_24_120232_create_product_skus_table.php @@ -30,13 +30,13 @@ class CreateProductSkusTable extends Migration $table->integer('weight')->unsigned()->nullable()->comment('重量:g'); $table->json('attrs')->nullable()->comment('属性文本'); $table->tinyInteger('is_sell')->unsigned()->default(0)->comment('在售状态'); - $table->tinyInteger('is_recommend')->unsigned()->default(0)->comment('是否推荐'); $table->json('spec_items')->nullable()->comment('规格属性'); $table->integer('stock')->unsigned()->default(0)->comment('库存'); $table->integer('sells')->unsigned()->default(0)->comment('销量'); $table->timestamps(); $table->index('spu_id'); + $table->index('category_id'); }); }