数据库迁移优化

This commit is contained in:
liu
2026-08-20 16:52:58 +08:00
parent 4fe4e985f6
commit 1dfa084508
4 changed files with 6 additions and 6 deletions
@@ -32,18 +32,18 @@ return new class extends Migration
$table->increments('id')->comment('商品ID');
$table->integer('category_id')->default(0)->comment('商品分类ID');
$table->integer('supplier_id')->default(0)->comment('默认供应商ID');
$table->string('market', 50)->default('')->comment('市场(如:新发地、岳各庄)');
$table->string('market', 50)->default('')->nullable()->comment('市场(如:新发地、岳各庄)');
$table->string('name', 100)->comment('品名');
$table->string('spec', 100)->default('')->comment('规格/包规');
$table->string('unit', 20)->default('斤')->comment('计价单位(斤/件/箱等)');
$table->string('image_ids', 255)->default('')->comment('商品图片');
$table->text('content')->comment('商品图文详情');
$table->integer('sort')->default(0)->comment('排序');
$table->integer('shelf_life')->default(0)->comment('保质期');
$table->integer('shelf_life')->default(0)->nullable()->comment('保质期');
$table->integer('stock')->default(0)->comment('库存');
$table->integer('status')->default(1)->comment('状态(1上架 0下架)');
$table->decimal('cost_price', 10, 2)->default(0)->comment('成本价(元,成本百分比计价基数)');
$table->string('remark', 255)->default('')->comment('备注');
$table->string('remark', 255)->nullable()->default('')->comment('备注');
$table->timestamps();
$table->softDeletes();
$table->index(['category_id', 'status'], 'product_category_status_index');
@@ -25,7 +25,7 @@ return new class extends Migration
$table->decimal('total_weight', 10, 3)->default(0)->comment('总重量');
$table->decimal('total_amount', 10, 2)->default(0)->comment('订单总金额');
$table->integer('status')->default(0)->comment('订单状态(0待接单 1已接单 2采购中 3配送中 4已完成 9已取消)');
$table->string('remark', 255)->default('')->comment('订单备注');
$table->string('remark', 255)->default('')->nullable()->comment('订单备注');
$table->softDeletes();
$table->timestamps();
$table->index(['store_id', 'order_date'], 'store_order_store_date_index');
@@ -24,7 +24,7 @@ return new class extends Migration
$table->decimal('estimate_amount', 10, 2)->default(0)->comment('预估金额(按订货汇总)');
$table->decimal('actual_amount', 10, 2)->default(0)->comment('实际采购金额');
$table->integer('operator_id')->default(0)->comment('采购员(系统用户ID');
$table->string('remark', 255)->default('')->comment('备注');
$table->string('remark', 255)->default('')->nullable()->comment('备注');
$table->timestamps();
$table->index(['purchase_date', 'status'], 'purchase_order_date_status_index');
$table->comment('采购单表');
@@ -35,7 +35,7 @@ return new class extends Migration
$table->string('pay_remark', 255)->default('')->comment('付款备注(线下收款信息)');
$table->integer('paid_operator_id')->default(0)->comment('收款操作人(后台系统用户ID)');
$table->integer('operator_id')->default(0)->comment('生成人(后台系统用户ID');
$table->string('remark', 255)->default('')->comment('备注');
$table->string('remark', 255)->nullable()->default('')->comment('备注');
$table->timestamps();
$table->unique(['purchase_id', 'store_id'], 'bill_purchase_store_unique');
$table->index(['store_id', 'bill_date'], 'bill_store_date_index');