Skip to content
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

feature/#118 DB 쿼리 작성 #121

Merged
merged 7 commits into from
Dec 1, 2024
Merged

Conversation

LeeShinHaeng
Copy link
Contributor

Summary

close #118

Tasks

  • schema.sql에 CREATE 작성
  • data.sql에 INSERT 작성

@LeeShinHaeng LeeShinHaeng added the ✨feature create new feature label Nov 29, 2024
@LeeShinHaeng LeeShinHaeng requested a review from a team November 29, 2024 15:40
@LeeShinHaeng LeeShinHaeng self-assigned this Nov 29, 2024
@LeeShinHaeng LeeShinHaeng linked an issue Nov 29, 2024 that may be closed by this pull request
3 tasks
Copy link
Contributor

coderabbitai bot commented Nov 29, 2024

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

이 변경 사항은 데이터베이스의 여러 테이블을 정의하고 데이터를 삽입하기 위한 SQL 스크립트를 포함합니다. schema.sql 파일은 about, lab, professor, file_entity, carousel, user, post, comment 테이블의 구조를 정의하며, 각 테이블의 필드와 제약 조건을 명시합니다. data.sql 파일은 이러한 테이블에 더미 데이터를 삽입하는 여러 SQL INSERT 문을 포함합니다.

Changes

파일 경로 변경 요약
aics-api/src/main/resources/db/schema.sql 여러 테이블(about, lab, professor, file_entity, carousel, user, post, comment) 생성 및 필드 정의. 인덱스 생성.
aics-api/src/main/resources/db/data.sql 여러 테이블에 더미 데이터 삽입을 위한 SQL INSERT 문 추가.

Assessment against linked issues

Objective Addressed Explanation
DDL 및 더미데이터 쿼리 작성 (#118)
schema.sql 파일에 CREATE 문 작성 (#118)
data.sql 파일에 INSERT 쿼리 작성 (#118)

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Outside diff range and nitpick comments (3)
aics-api/src/main/resources/db/data.sql (1)

1-4: 더미 데이터의 내용이 너무 간단합니다.

현재 데이터가 실제 운영 환경과 비슷한 형태를 갖추도록 더 자세한 내용으로 보완하면 좋겠습니다.

예시:

-VALUES ('학과 소개 내용입니다.', NULL, 'DEPT_INTRO', 'DEPT_INTRO'),
+VALUES ('경기대학교 인공지능컴퓨터공학부는 4차 산업혁명 시대를 선도할 AI 전문가를 양성하고 있습니다...', NULL, 'DEPT_INTRO', 'DEPT_INTRO'),
aics-api/src/main/resources/db/schema.sql (2)

118-136: 인덱스 전략 최적화 필요

현재 인덱스 구성에 대한 다음 개선사항을 제안드립니다:

  1. 외래 키에 대한 인덱스는 자동으로 생성되므로 일부 중복될 수 있습니다:
  • idx_carousel_file_id
  • idx_comment_post_id
  • idx_comment_author_id
  • idx_post_author_id
  1. 복합 인덱스 고려가 필요합니다:
-- 게시글 검색 최적화를 위한 복합 인덱스
CREATE INDEX idx_post_category_created_at ON post(category, created_at DESC);

-- 제목 검색과 함께 카테고리 필터링을 위한 복합 인덱스
CREATE INDEX idx_post_category_title ON post(category, title);
  1. 각 인덱스의 사용 패턴을 모니터링하고, 사용되지 않는 인덱스는 제거하는 것을 권장드립니다.

1-114: 아키텍처 관련 제안사항

데이터베이스 스키마의 확장성과 운영 효율성을 위한 제안사항입니다:

  1. 대용량 테이블 파티셔닝 전략:
  • post 테이블: 카테고리별 또는 생성일자별 파티셔닝
  • comment 테이블: post_id 기준 파티셔닝
  1. 감사 로깅 전략:
CREATE TABLE audit_log (
    id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
    table_name VARCHAR(50) NOT NULL,
    record_id VARCHAR(50) NOT NULL,
    action VARCHAR(10) NOT NULL,
    old_data JSONB,
    new_data JSONB,
    changed_by VARCHAR(10) NOT NULL,
    changed_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP
);
  1. 테이블 및 컬럼에 대한 COMMENT 추가를 권장드립니다:
COMMENT ON TABLE post IS '게시글 정보';
COMMENT ON COLUMN post.title IS '게시글 제목';
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between dbdd03f and c947fa6.

📒 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)
🔇 Additional comments (3)
aics-api/src/main/resources/db/data.sql (3)

25-33: 파일 구조가 잘 정리되어 있습니다.

파일 경로가 논리적으로 잘 구성되어 있으며, 파일명도 명확합니다.


35-39: 데이터 구조와 참조가 올바르게 구성되어 있습니다.

파일 참조와 URL 구조가 일관성 있게 잘 작성되어 있습니다.


42-57: 게시글 내용은 잘 작성되었으나, 작성자 ID 참조에 문제가 있습니다.

게시글의 내용과 구조는 실제 운영 환경과 유사하게 잘 작성되었습니다. 하지만 앞서 언급된 것처럼 존재하지 않는 작성자 ID(202412345)를 참조하고 있습니다.

aics-api/src/main/resources/db/data.sql Show resolved Hide resolved
aics-api/src/main/resources/db/data.sql Show resolved Hide resolved
aics-api/src/main/resources/db/data.sql Outdated Show resolved Hide resolved
aics-api/src/main/resources/db/schema.sql Outdated Show resolved Hide resolved
aics-api/src/main/resources/db/schema.sql Outdated Show resolved Hide resolved
aics-api/src/main/resources/db/schema.sql Outdated Show resolved Hide resolved
Copy link
Member

@LeeHanEum LeeHanEum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인이 늦었습니다! 코멘트 하나만 검토 부탁드립니다!

aics-api/src/main/resources/db/schema.sql Outdated Show resolved Hide resolved
Copy link
Member

@LeeHanEum LeeHanEum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM👍

@LeeShinHaeng LeeShinHaeng merged commit ffac8eb into develop Dec 1, 2024
2 checks passed
@LeeShinHaeng LeeShinHaeng deleted the feature/#118-write-db-query branch December 1, 2024 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨feature create new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DDL 및 더미데이터 쿼리 작성
2 participants