Skip to content

Commit 5cf52ce

Browse files
authored
Merge pull request #65 from Last-COMMIT/develop
[Merge] 배포 오류 수정(flyway)
2 parents b0d7f02 + 6ba594f commit 5cf52ce

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

src/main/resources/db/migration/V12__modify_document_type_enum.sql renamed to src/main/resources/db/migration/V13__modify_document_type_enum.sql

File renamed without changes.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
-- =====================================================
2+
-- PIILOT Database Migration
3+
-- V14: 파일 서버 유형 정리 (FTP, SFTP, WEBDAV만 유지)
4+
-- =====================================================
5+
6+
-- 1. file_server_connections의 기존 type_id를 임시 값으로 변경 (충돌 방지)
7+
-- 기존: FTP(4), SFTP(5), WEBDAV(6) → 임시: 104, 105, 106
8+
UPDATE file_server_connections SET server_type_id = 104 WHERE server_type_id = 4;
9+
UPDATE file_server_connections SET server_type_id = 105 WHERE server_type_id = 5;
10+
UPDATE file_server_connections SET server_type_id = 106 WHERE server_type_id = 6;
11+
12+
-- 2. Local, NAS, S3 참조하는 연결 삭제 (사용하지 않는 유형)
13+
DELETE FROM file_server_connections WHERE server_type_id IN (1, 2, 3);
14+
15+
-- 3. 외래키 제약 조건 임시 비활성화
16+
ALTER TABLE file_server_connections DROP CONSTRAINT IF EXISTS fk_file_conn_server_type;
17+
18+
-- 4. 기존 file_server_types 데이터 모두 삭제
19+
DELETE FROM file_server_types;
20+
21+
-- 5. 시퀀스 리셋
22+
ALTER SEQUENCE file_server_types_id_seq RESTART WITH 1;
23+
24+
-- 6. FTP, SFTP, WEBDAV 순서로 재삽입 (ID: 1, 2, 3)
25+
INSERT INTO file_server_types (id, name) VALUES
26+
(1, 'FTP'),
27+
(2, 'SFTP'),
28+
(3, 'WEBDAV');
29+
30+
-- 7. 시퀀스를 4부터 시작하도록 설정
31+
ALTER SEQUENCE file_server_types_id_seq RESTART WITH 4;
32+
33+
-- 8. file_server_connections의 type_id를 새 ID로 업데이트
34+
-- 임시: 104→1(FTP), 105→2(SFTP), 106→3(WEBDAV)
35+
UPDATE file_server_connections SET server_type_id = 1 WHERE server_type_id = 104;
36+
UPDATE file_server_connections SET server_type_id = 2 WHERE server_type_id = 105;
37+
UPDATE file_server_connections SET server_type_id = 3 WHERE server_type_id = 106;
38+
39+
-- 9. 외래키 제약 조건 다시 활성화
40+
ALTER TABLE file_server_connections
41+
ADD CONSTRAINT fk_file_conn_server_type
42+
FOREIGN KEY (server_type_id) REFERENCES file_server_types(id);

0 commit comments

Comments
 (0)