diff --git a/database/migrations/2026_02_26_100000_create_attendance_requests_table.php b/database/migrations/2026_02_26_100000_create_attendance_requests_table.php new file mode 100644 index 0000000..3a969c2 --- /dev/null +++ b/database/migrations/2026_02_26_100000_create_attendance_requests_table.php @@ -0,0 +1,39 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->unsignedBigInteger('user_id')->comment('신청자'); + $table->enum('request_type', ['vacation', 'businessTrip', 'remote', 'fieldWork'])->comment('신청 유형'); + $table->date('start_date'); + $table->date('end_date'); + $table->text('reason')->nullable()->comment('사유'); + $table->enum('status', ['pending', 'approved', 'rejected'])->default('pending'); + $table->unsignedBigInteger('approved_by')->nullable()->comment('승인자'); + $table->timestamp('approved_at')->nullable(); + $table->text('reject_reason')->nullable()->comment('반려 사유'); + $table->json('json_details')->nullable()->comment('반차 구분 등 추가 정보'); + $table->timestamps(); + $table->softDeletes(); + + $table->foreign('tenant_id')->references('id')->on('tenants')->cascadeOnDelete(); + $table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete(); + + $table->index(['tenant_id', 'status']); + $table->index(['tenant_id', 'user_id']); + }); + } + + public function down(): void + { + Schema::dropIfExists('attendance_requests'); + } +};