feat:가입비(registration_fee) 컬럼 추가 및 시더 업데이트

This commit is contained in:
pro
2026-01-29 16:31:50 +09:00
parent 8327568a77
commit ff829ad184
2 changed files with 34 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('sales_products', function (Blueprint $table) {
$table->decimal('registration_fee', 15, 2)->default(0)->after('development_fee')->comment('가입비 (할인된 가격)');
});
// 기존 데이터: 가입비 = 개발비 × 25%
DB::statement('UPDATE sales_products SET registration_fee = development_fee * 0.25');
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('sales_products', function (Blueprint $table) {
$table->dropColumn('registration_fee');
});
}
};

View File

@@ -153,6 +153,7 @@ public function run(): void
DB::table('sales_products')->insert([
'category_id' => $categoryIds['MANUFACTURER'],
...$product,
'registration_fee' => $product['development_fee'] * 0.25,
'is_active' => true,
'created_at' => now(),
'updated_at' => now(),
@@ -203,6 +204,7 @@ public function run(): void
DB::table('sales_products')->insert([
'category_id' => $categoryIds['CONSTRUCTION'],
...$product,
'registration_fee' => $product['development_fee'] * 0.25,
'is_active' => true,
'created_at' => now(),
'updated_at' => now(),