diff --git a/database/migrations/2026_11_19_180000_create_business_actual_tax_records_table.php b/database/migrations/2026_11_19_180000_create_business_actual_tax_records_table.php index aeb7876c..991646c5 100644 --- a/database/migrations/2026_11_19_180000_create_business_actual_tax_records_table.php +++ b/database/migrations/2026_11_19_180000_create_business_actual_tax_records_table.php @@ -97,9 +97,9 @@ return new class extends Migration } $table->decimal('employee_count', 12, 2)->nullable(); - $table->decimal('tax_burden_rate', 12, 8)->nullable(); - $table->decimal('labor_ratio', 12, 8)->nullable(); - $table->decimal('net_profit_margin', 12, 8)->nullable(); + $table->decimal('tax_burden_rate', 18, 8)->nullable(); + $table->decimal('labor_ratio', 18, 8)->nullable(); + $table->decimal('net_profit_margin', 18, 8)->nullable(); $table->string('estimated_goods_cost', 191)->nullable(); $table->string('tax_declaration_status', 64)->nullable(); diff --git a/database/migrations/2026_11_19_190000_widen_actual_tax_ratio_columns.php b/database/migrations/2026_11_19_190000_widen_actual_tax_ratio_columns.php new file mode 100644 index 00000000..2cfcd524 --- /dev/null +++ b/database/migrations/2026_11_19_190000_widen_actual_tax_ratio_columns.php @@ -0,0 +1,37 @@ +connection()); + if (! $schema->hasTable('business_actual_tax_records')) { + return; + } + + $schema->table('business_actual_tax_records', function (Blueprint $table): void { + // 源表存在超过 9999 的异常百分比,按原值保存,不静默截断业务数据。 + $table->decimal('tax_burden_rate', 18, 8)->nullable()->change(); + $table->decimal('labor_ratio', 18, 8)->nullable()->change(); + $table->decimal('net_profit_margin', 18, 8)->nullable()->change(); + }); + } + + public function down(): void + { + // 精度加宽向后兼容;不回缩,避免已有大值导致回滚失败或数据截断。 + } + + private function connection(): string + { + return (string) config('upstream_mirrors.connection', 'business_mirror'); + } +};