feat: 다수 기능 개선 - 순찰, 출근, 작업분석, 모바일 UI 등
- 순찰/점검 기능 개선 (zone-detail 페이지 추가) - 출근/근태 시스템 개선 (연차 조회, 근무현황) - 작업분석 대분류 그룹화 및 마이그레이션 스크립트 - 모바일 네비게이션 UI 추가 - NAS 배포 도구 및 문서 추가 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Migration: Create vacation_requests table
|
||||
* Purpose: Track vacation request workflow (request, approval/rejection)
|
||||
* Date: 2026-01-29
|
||||
*/
|
||||
|
||||
exports.up = async function(knex) {
|
||||
// Create vacation_requests table
|
||||
await knex.schema.createTable('vacation_requests', (table) => {
|
||||
table.increments('request_id').primary().comment('휴가 신청 ID');
|
||||
|
||||
// 작업자 정보
|
||||
table.integer('worker_id').notNullable().comment('작업자 ID');
|
||||
table.foreign('worker_id').references('worker_id').inTable('workers').onDelete('CASCADE');
|
||||
|
||||
// 휴가 정보
|
||||
table.integer('vacation_type_id').unsigned().notNullable().comment('휴가 유형 ID');
|
||||
table.foreign('vacation_type_id').references('id').inTable('vacation_types').onDelete('RESTRICT');
|
||||
|
||||
table.date('start_date').notNullable().comment('휴가 시작일');
|
||||
table.date('end_date').notNullable().comment('휴가 종료일');
|
||||
table.decimal('days_used', 4, 1).notNullable().comment('사용 일수 (0.5일 단위)');
|
||||
|
||||
table.text('reason').nullable().comment('휴가 사유');
|
||||
|
||||
// 신청 및 승인 정보
|
||||
table.enum('status', ['pending', 'approved', 'rejected'])
|
||||
.notNullable()
|
||||
.defaultTo('pending')
|
||||
.comment('승인 상태: pending(대기), approved(승인), rejected(거부)');
|
||||
|
||||
table.integer('requested_by').notNullable().comment('신청자 user_id');
|
||||
table.foreign('requested_by').references('user_id').inTable('users').onDelete('RESTRICT');
|
||||
|
||||
table.integer('reviewed_by').nullable().comment('승인/거부자 user_id');
|
||||
table.foreign('reviewed_by').references('user_id').inTable('users').onDelete('SET NULL');
|
||||
|
||||
table.timestamp('reviewed_at').nullable().comment('승인/거부 일시');
|
||||
table.text('review_note').nullable().comment('승인/거부 메모');
|
||||
|
||||
// 타임스탬프
|
||||
table.timestamp('created_at').defaultTo(knex.fn.now()).comment('신청 일시');
|
||||
table.timestamp('updated_at').defaultTo(knex.fn.now()).comment('수정 일시');
|
||||
|
||||
// 인덱스
|
||||
table.index('worker_id', 'idx_vacation_requests_worker');
|
||||
table.index('status', 'idx_vacation_requests_status');
|
||||
table.index(['start_date', 'end_date'], 'idx_vacation_requests_dates');
|
||||
});
|
||||
|
||||
console.log('✅ vacation_requests 테이블 생성 완료');
|
||||
};
|
||||
|
||||
exports.down = async function(knex) {
|
||||
await knex.schema.dropTableIfExists('vacation_requests');
|
||||
console.log('✅ vacation_requests 테이블 삭제 완료');
|
||||
};
|
||||
Reference in New Issue
Block a user