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(); + }); + } + } +};