/** * 출퇴근 출근 여부 필드 추가 * 아침 출근 확인용 간단한 필드 */ exports.up = async function(knex) { // 컬럼 존재 여부 확인 const hasColumn = await knex.schema.hasColumn('daily_attendance_records', 'is_present'); if (!hasColumn) { await knex.schema.table('daily_attendance_records', (table) => { // 출근 여부 (아침에 체크) table.boolean('is_present').defaultTo(true).comment('출근 여부'); }); // 기존 데이터는 모두 출근으로 처리 await knex('daily_attendance_records') .whereNotNull('id') .update({ is_present: true }); console.log('✅ is_present 컬럼 추가 완료'); } else { console.log('⏭️ is_present 컬럼이 이미 존재합니다'); } }; exports.down = async function(knex) { const hasColumn = await knex.schema.hasColumn('daily_attendance_records', 'is_present'); if (hasColumn) { await knex.schema.table('daily_attendance_records', (table) => { table.dropColumn('is_present'); }); } };