-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor/#152 DDL 및 DML 최신화 #153
Conversation
Walkthrough이 풀 리퀘스트는 데이터베이스 스키마와 초기 데이터 파일을 업데이트합니다. Changes
Assessment against linked issues
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Test Coverage Report
|
Codecov ReportAll modified and coverable lines are covered by tests ✅ @@ Coverage Diff @@
## develop #153 +/- ##
==========================================
Coverage 83.95% 83.95%
Complexity 79 79
==========================================
Files 21 21
Lines 293 293
Branches 4 4
==========================================
Hits 246 246
Misses 41 41
Partials 6 6 Continue to review full report in Codecov by Sentry.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (2)
aics-api/src/main/resources/db/schema.sql (1)
Line range hint
1-150
: 인덱스 추가 검토 필요성능 최적화를 위해 다음 인덱스 추가를 검토해주세요:
file_entity
:extension
컬럼 (파일 타입별 조회 최적화)post
:category
,created_at
복합 인덱스 (카테고리별 최신 글 조회)comment
:post_id
,created_at
복합 인덱스 (게시글별 댓글 조회)aics-api/src/main/resources/db/data.sql (1)
1-112
: 테스트 데이터 다양성 개선 필요더 다양한 테스트 케이스를 위해 다음 데이터 추가를 검토해주세요:
- 삭제된 데이터 (
deleted_at
값이 있는 레코드)- 다양한 시간대의
created_at
,updated_at
값- 특수 문자나 이모지가 포함된 콘텐츠
- 최대 길이에 가까운 텍스트 데이터
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
aics-api/src/main/resources/db/data.sql
(1 hunks)aics-api/src/main/resources/db/schema.sql
(1 hunks)
file_size VARCHAR(10) NOT NULL, | ||
extension VARCHAR(10) NOT NULL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
file_size
컬럼 타입 개선 필요
다음과 같은 개선사항을 제안드립니다:
file_size
컬럼을BIGINT
로 변경하여 바이트 단위의 정확한 파일 크기를 저장extension
컬럼의 길이를VARCHAR(10)
에서VARCHAR(5)
로 축소 (일반적인 파일 확장자 길이 고려)
- file_size VARCHAR(10) NOT NULL,
- extension VARCHAR(10) NOT NULL,
+ file_size BIGINT NOT NULL,
+ extension VARCHAR(5) NOT NULL,
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
file_size VARCHAR(10) NOT NULL, | |
extension VARCHAR(10) NOT NULL, | |
file_size BIGINT NOT NULL, | |
extension VARCHAR(5) NOT NULL, |
INSERT INTO "user" (id, password, name, email, phone, major, role, created_at, updated_at) | ||
VALUES ('202412346', '$2a$10$NkQj6yk0Xh4QhKevjrOkouQBymXUgpKqmHQFnTUKRaVhDrRZf5OTG', '이한음', 'haneum@kgu.ac.kr', | ||
'010-2345-6789', 'AIT', 'SUPER', CURRENT_TIMESTAMP, | ||
CURRENT_TIMESTAMP), | ||
('202412347', '$2a$10$NkQj6yk0Xh4QhKevjrOkouQBymXUgpKqmHQFnTUKRaVhDrRZf5OTG', '박민준', 'minjun@kyonggi.ac.kr', | ||
'010-1234-8765', 'CSE', 'USER', CURRENT_TIMESTAMP, | ||
CURRENT_TIMESTAMP), | ||
('202412348', '$2a$10$NkQj6yk0Xh4QhKevjrOkouQBymXUgpKqmHQFnTUKRaVhDrRZf5OTG', '이신행', 'shinhaeng@kyonggi.ac.kr', | ||
'010-3456-7890', 'SSS', 'ADMIN', CURRENT_TIMESTAMP, | ||
CURRENT_TIMESTAMP); | ||
VALUES ('202412346', '$2a$10$NkQj6yk0Xh4QhKevjrOkouQBymXUgpKqmHQFnTUKRaVhDrRZf5OTG', | ||
'이한음', 'haneum@kgu.ac.kr', '010-2345-6789', 'AIT', 'SUPER', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), | ||
('202412347', '$2a$10$NkQj6yk0Xh4QhKevjrOkouQBymXUgpKqmHQFnTUKRaVhDrRZf5OTG', | ||
'박민준', 'minjun@kyonggi.ac.kr', '010-1234-8765', 'CSE', 'USER', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), | ||
('202412348', '$2a$10$NkQj6yk0Xh4QhKevjrOkouQBymXUgpKqmHQFnTUKRaVhDrRZf5OTG', | ||
'이신행', 'shinhaeng@kyonggi.ac.kr', '010-3456-7890', 'SSS', 'ADMIN', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), | ||
('202412349', '$2a$10$NkQj6yk0Xh4QhKevjrOkouQBymXUgpKqmHQFnTUKRaVhDrRZf5OTG', | ||
'홍길동', 'hong@kyonggi.ac.kr', '010-5678-1234', 'CSE', 'USER', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), | ||
('202412350', '$2a$10$NkQj6yk0Xh4QhKevjrOkouQBymXUgpKqmHQFnTUKRaVhDrRZf5OTG', | ||
'김철수', 'kim@kyonggi.ac.kr', '010-8765-4321', 'CSE', 'SUPER', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
테스트 데이터 보안 강화 필요
- 실제 이메일 도메인 사용 대신 예시 도메인(
example.com
) 사용 권장 - 전화번호는 가상의 번호로 대체 필요
- 비밀번호 해시값을 테스트용 문자열로 대체 권장
INSERT INTO file_entity (logical_name, physical_path, extension, file_size, created_at, updated_at) | ||
VALUES ('학과소개파일', '/files/about/dept_intro.pdf', 'pdf', '12345', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), | ||
('교육활동파일', '/files/edu/activities.pdf', 'pdf', '23456', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), | ||
('커리큘럼파일', '/files/edu/curriculum.pdf', 'pdf', '34567', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), | ||
('연구 성과 이미지', '/files/carousel/research_results.jpg', 'jpg', '45678', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), | ||
('학과 행사 이미지', '/files/carousel/department_event.jpg', 'jpg', '56789', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), | ||
('동아리 활동 이미지', '/files/carousel/club_activity.jpg', 'jpg', '67890', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), | ||
('캠퍼스 전경 이미지', '/files/carousel/campus_view.jpg', 'jpg', '78901', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), | ||
('졸업식 이미지', '/files/carousel/graduation_ceremony.jpg', 'jpg', '89012', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), | ||
('취업 설명회 자료', '/files/employment/info.pdf', 'pdf', '54321', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), | ||
('연구 프로젝트 소개', '/files/research/project_intro.pdf', 'pdf', '65432', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
파일 데이터 개선 필요
file_size
값들이 문자열 형태로 저장되어 있습니다. 컬럼 타입을BIGINT
로 변경 시 숫자로 변환 필요physical_path
에 대한 보안 검토 필요:- 경로 주입 공격 방지
- 파일 시스템 접근 제한
- 실제 파일 존재 여부 확인
-VALUES ('학과소개파일', '/files/about/dept_intro.pdf', 'pdf', '12345', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
+VALUES ('학과소개파일', '/files/about/dept_intro.pdf', 'pdf', 12345, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
Committable suggestion skipped: line range outside the PR's diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 개발 DB 데이터 삭제 후 새로운 데이터셋 삽입 부탁드려요~
Summary
Tasks
To Reviewer
Hibernate가 생성한 테이블과 schema로 생성한 테이블 둘다 에러 발생하지 않도록 DML 수정했습니다. 혹시 수정 필요한 부분 있으면 말씀해주세용😁