-- migrations/003_normalize_table_names.sql
-- 모든 테이블명을 snake_case로 변경하여 룰 준수

-- 기존 PascalCase 테이블들을 snake_case로 변경

-- 1. Users -> users
RENAME TABLE Users TO users;

-- 2. CuttingPlan -> cutting_plan
RENAME TABLE CuttingPlan TO cutting_plan;

-- 3. DailyIssueReports -> daily_issue_reports
RENAME TABLE DailyIssueReports TO daily_issue_reports;

-- 4. EquipmentList -> equipment_list
RENAME TABLE EquipmentList TO equipment_list;

-- 5. FactoryInfo -> factory_info
RENAME TABLE FactoryInfo TO factory_info;

-- 6. IssueTypes -> issue_types
RENAME TABLE IssueTypes TO issue_types;

-- 7. PipeSpecs -> pipe_specs
RENAME TABLE PipeSpecs TO pipe_specs;

-- 8. Processes -> processes (이미 소문자이지만 통일성 위해)
-- RENAME TABLE Processes TO processes; -- 이미 소문자면 스킵

-- 9. Projects -> projects
RENAME TABLE Projects TO projects;

-- 10. Tasks -> tasks
RENAME TABLE Tasks TO tasks;

-- 11. WorkReports -> work_reports
RENAME TABLE WorkReports TO work_reports;

-- 12. Workers -> workers
RENAME TABLE Workers TO workers;

-- 이미 snake_case인 테이블들은 그대로 유지:
-- activity_logs
-- daily_work_reports
-- daily_worker_summary
-- error_types
-- login_logs
-- password_change_logs
-- uploaded_documents
-- work_report_audit_log
-- work_status_types
-- work_types
-- worker_groups

-- 변경 완료 로그
SELECT 'Table names normalized to snake_case according to project rules' as migration_status;