feat(api): 배송방식 공통코드 추가

- delivery_method 코드 그룹 추가
- direct: 상차, pickup: 택배

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-01-23 16:01:32 +09:00
parent 131c0fc5dc
commit e285e3eca2

View File

@@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$now = now();
// delivery_method 코드 그룹 (배송방식)
$deliveryMethods = [
['code' => 'direct', 'name' => '상차', 'sort_order' => 1],
['code' => 'pickup', 'name' => '택배', 'sort_order' => 2],
];
foreach ($deliveryMethods as $item) {
DB::table('common_codes')->updateOrInsert(
['code_group' => 'delivery_method', 'code' => $item['code']],
[
'code_group' => 'delivery_method',
'code' => $item['code'],
'name' => $item['name'],
'sort_order' => $item['sort_order'],
'is_active' => true,
'created_at' => $now,
'updated_at' => $now,
]
);
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
DB::table('common_codes')->where('code_group', 'delivery_method')->delete();
}
};