diff --git a/database/migrations/2026_01_29_162847_add_registration_fee_to_sales_products_table.php b/database/migrations/2026_01_29_162847_add_registration_fee_to_sales_products_table.php new file mode 100644 index 0000000..4a6aa96 --- /dev/null +++ b/database/migrations/2026_01_29_162847_add_registration_fee_to_sales_products_table.php @@ -0,0 +1,32 @@ +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'); + }); + } +}; diff --git a/database/seeders/SalesProductSeeder.php b/database/seeders/SalesProductSeeder.php index 7501ad2..3e77387 100644 --- a/database/seeders/SalesProductSeeder.php +++ b/database/seeders/SalesProductSeeder.php @@ -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(),