fix(actual-tax): widen ratio columns to preserve source values
This commit is contained in:
parent
58506f45a7
commit
3240342fa4
@ -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();
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (config('system_database.mode', 'bootstrap') === 'bootstrap') {
|
||||
return;
|
||||
}
|
||||
|
||||
$schema = Schema::connection($this->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');
|
||||
}
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user