feat: [account] 계정과목 카테고리 영문 통일 마이그레이션
- 한글 카테고리(자산/부채/자본/수익/비용)를 영문(asset/liability/capital/revenue/expense)으로 변환 - API 표준에 맞춰 전체 테넌트 통일
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* 계정과목 카테고리를 영문으로 통일
|
||||
*
|
||||
* tenant_id=1(코드브릿지엑스 본사)에 한글 카테고리가 섞여 있어
|
||||
* API 표준(영문)으로 통일한다.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$mapping = [
|
||||
'자산' => 'asset',
|
||||
'부채' => 'liability',
|
||||
'자본' => 'capital',
|
||||
'수익' => 'revenue',
|
||||
'비용' => 'expense',
|
||||
];
|
||||
|
||||
foreach ($mapping as $korean => $english) {
|
||||
DB::table('account_codes')
|
||||
->where('category', $korean)
|
||||
->update(['category' => $english]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
$mapping = [
|
||||
'asset' => '자산',
|
||||
'liability' => '부채',
|
||||
'capital' => '자본',
|
||||
'revenue' => '수익',
|
||||
'expense' => '비용',
|
||||
];
|
||||
|
||||
// tenant_id=1만 원복 (다른 테넌트는 원래 영문)
|
||||
foreach ($mapping as $english => $korean) {
|
||||
DB::table('account_codes')
|
||||
->where('tenant_id', 1)
|
||||
->where('category', $english)
|
||||
->update(['category' => $korean]);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user