diff --git a/database/migrations/2026_03_17_105822_unify_account_codes_category_to_english.php b/database/migrations/2026_03_17_105822_unify_account_codes_category_to_english.php new file mode 100644 index 00000000..74e2ef91 --- /dev/null +++ b/database/migrations/2026_03_17_105822_unify_account_codes_category_to_english.php @@ -0,0 +1,52 @@ + '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]); + } + } +};