From 09ae442b87a5a3ef41541b7a4d2bfe6158109348 Mon Sep 17 00:00:00 2001 From: qiuxiang <394405259@qq.com> Date: Thu, 8 Oct 2026 13:30:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=AB=E9=80=92=E8=BF=90=E8=B4=B9=EF=BC=9A?= =?UTF-8?q?=E8=A1=A5=20deleted=5Fat=EF=BC=88=E6=A8=A1=E5=9E=8B=E5=9F=BA?= =?UTF-8?q?=E7=B1=BB=E5=B8=A6=E8=BD=AF=E5=88=A0=E9=99=A4=EF=BC=8C=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=9F=A5=E8=AF=A2=E6=8A=A5=20Unknown=20column?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 建表迁移同步补 softDeletes,另加一个迁移修复已建好的表;两个迁移都带存在性判断,可重复执行。 --- ..._08_120000_create_courier_freight_rows.php | 1 + ...d_soft_deletes_to_courier_freight_rows.php | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 database/migrations/2026_10_08_130000_add_soft_deletes_to_courier_freight_rows.php diff --git a/database/migrations/2026_10_08_120000_create_courier_freight_rows.php b/database/migrations/2026_10_08_120000_create_courier_freight_rows.php index d520b7fd..d3c33152 100644 --- a/database/migrations/2026_10_08_120000_create_courier_freight_rows.php +++ b/database/migrations/2026_10_08_120000_create_courier_freight_rows.php @@ -26,6 +26,7 @@ return new class extends Migration $table->string('transaction_no', 191)->comment('交易单号'); $table->decimal('freight_amount', 18, 4)->default(0)->comment('提供成本运费'); $table->timestamps(); + $table->softDeletes(); $table->index(['company_id', 'source'], 'courier_freight_company_source'); $table->index(['company_id', 'transaction_no'], 'courier_freight_company_txn'); diff --git a/database/migrations/2026_10_08_130000_add_soft_deletes_to_courier_freight_rows.php b/database/migrations/2026_10_08_130000_add_soft_deletes_to_courier_freight_rows.php new file mode 100644 index 00000000..2cf4bae7 --- /dev/null +++ b/database/migrations/2026_10_08_130000_add_soft_deletes_to_courier_freight_rows.php @@ -0,0 +1,35 @@ +softDeletes(); + }); + } + } + + public function down(): void + { + if (Schema::hasTable('courier_freight_rows') && Schema::hasColumn('courier_freight_rows', 'deleted_at')) { + Schema::table('courier_freight_rows', function (Blueprint $table): void { + $table->dropSoftDeletes(); + }); + } + } +};