feat:차량일지(운행기록부) 테이블 마이그레이션 추가
- vehicle_logs 테이블 생성 - 운행 정보 (날짜, 부서, 운전자, 구분) - 출발지/도착지 정보 (분류, 장소명, 주소) - 주행거리, 비고 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('vehicle_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('tenant_id')->index();
|
||||
$table->unsignedBigInteger('vehicle_id')->index();
|
||||
|
||||
// 운행 정보
|
||||
$table->date('log_date')->comment('운행 날짜');
|
||||
$table->string('department', 50)->nullable()->comment('부서');
|
||||
$table->string('driver_name', 50)->comment('운전자 성명');
|
||||
$table->enum('trip_type', ['commute_to', 'commute_from', 'business', 'personal'])
|
||||
->comment('구분: 출근용, 퇴근용, 업무용, 비업무');
|
||||
|
||||
// 출발지
|
||||
$table->enum('departure_type', ['home', 'office', 'client', 'other'])->nullable()
|
||||
->comment('출발지 분류: 자택, 회사, 거래처, 기타');
|
||||
$table->string('departure_name', 100)->nullable()->comment('출발지명');
|
||||
$table->string('departure_address', 200)->nullable()->comment('출발지 주소');
|
||||
|
||||
// 도착지
|
||||
$table->enum('arrival_type', ['home', 'office', 'client', 'other'])->nullable()
|
||||
->comment('도착지 분류: 자택, 회사, 거래처, 기타');
|
||||
$table->string('arrival_name', 100)->nullable()->comment('도착지명');
|
||||
$table->string('arrival_address', 200)->nullable()->comment('도착지 주소');
|
||||
|
||||
// 주행 정보
|
||||
$table->unsignedInteger('distance_km')->comment('주행거리(km)');
|
||||
$table->string('note', 200)->nullable()->comment('비고');
|
||||
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// 외래키
|
||||
$table->foreign('vehicle_id')->references('id')->on('corporate_vehicles')->cascadeOnDelete();
|
||||
|
||||
// 인덱스
|
||||
$table->index(['tenant_id', 'vehicle_id', 'log_date']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('vehicle_logs');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user