Files
TK-FB-Project/api.hyungi.net/db_archive/migrations/006_add_description_column.sql
Hyungi Ahn b67362a733 feat: Introduce knex for database migrations
- Adds knex.js to manage database schema changes systematically.
- Creates an initial migration file based on `hyungi_schema_v2.sql` to represent the current database state.
- Adds npm scripts (`db:migrate`, `db:rollback`, etc.) for easy execution of migration tasks.
- Archives legacy SQL files and old migration scripts into the `db_archive/` directory to prevent confusion and clean up the project structure.
2025-12-19 09:43:09 +09:00

17 lines
600 B
SQL

-- 006_add_description_column.sql
-- daily_work_reports 테이블에 description 컬럼 추가
-- description 컬럼 추가 (이미 존재하는 경우 무시)
SET @sql = (SELECT IF(
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'daily_work_reports'
AND table_schema = 'hyungi'
AND column_name = 'description') = 0,
'ALTER TABLE daily_work_reports ADD COLUMN description TEXT COMMENT ''작업 설명'' AFTER work_hours',
'SELECT ''description column already exists'' as message'
));
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;