feat(quote): quote_type 컬럼 추가 및 건설 견적 필터링 구현
- quotes 테이블에 quote_type 컬럼 추가 (manufacturing/construction) - Quote 모델에 TYPE 상수 및 스코프 메서드 추가 - QuoteService.index()에 quote_type 필터 적용 - QuoteService.upsertFromSiteBriefing()에 construction 타입 설정 - QuoteIndexRequest에 quote_type 유효성 검증 추가 - 기존 site_briefing_id 있는 데이터는 construction으로 자동 업데이트 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('quotes', function (Blueprint $table) {
|
||||
$table->string('quote_type', 20)
|
||||
->default('manufacturing')
|
||||
->after('tenant_id')
|
||||
->comment('견적 유형: manufacturing(제조), construction(시공)');
|
||||
|
||||
$table->index('quote_type', 'idx_quotes_quote_type');
|
||||
});
|
||||
|
||||
// 기존 데이터: site_briefing_id가 있으면 construction으로 설정
|
||||
DB::table('quotes')
|
||||
->whereNotNull('site_briefing_id')
|
||||
->update(['quote_type' => 'construction']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('quotes', function (Blueprint $table) {
|
||||
$table->dropIndex('idx_quotes_quote_type');
|
||||
$table->dropColumn('quote_type');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user