Skip to content
This repository was archived by the owner on Mar 15, 2025. It is now read-only.

[feat] 링크 통계 칼럼에 단축 url 적용 #1148

Open
kimminkyeu opened this issue Feb 27, 2025 · 0 comments
Open

[feat] 링크 통계 칼럼에 단축 url 적용 #1148

kimminkyeu opened this issue Feb 27, 2025 · 0 comments
Assignees
Labels
backend 백엔드 관련

Comments

@kimminkyeu
Copy link
Collaborator

kimminkyeu commented Feb 27, 2025

기능

LinkStats 링크 통계 엔티티

#1147 url unique 제약조건에 대한 @ss0ngcode 님의 피드백이 있었습니다.

CREATE TABLE baguni_db.link_stats
(
    id               BIGINT AUTO_INCREMENT PRIMARY KEY,
    date             DATE          NOT NULL,
    url              VARCHAR(2048) NOT NULL,
    view_count       BIGINT        NOT NULL DEFAULT 0,
    bookmarked_count BIGINT        NOT NULL DEFAULT 0,
    CONSTRAINT UC_DATE_URL UNIQUE (date, url(200))
)

이렇게 처리하는 경우 처음 200자가 동일한 링크가 있으면 중복으로 처리할것 같은데 문제 없을까요?
생각나는건 해당 url을 단축시키는 과정을 거치고 저장하는 것도 방법이 될 수 있을것 같은데
단축 url을 사용하려면

  1. 동일한 링크에 대해서 매번 동일한 결과값을 내는지 확인이 필요할 것 같음
  2. 원본 url은 그대로 저장하고 단축 url 컬럼을 추가해서 해당 컬럼을 유니크로 묶어서 처리하는게 좋을 것 같음

위 피드백을 바탕으로, unique 제약 조건을 긴 url이 아닌 단축 url로 매핑하는 작업을 진행합니다.

@kimminkyeu kimminkyeu changed the title [feat] [feat] 링크 통계 칼럼에 단축 url 적용 Feb 27, 2025
@kimminkyeu kimminkyeu added the backend 백엔드 관련 label Feb 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backend 백엔드 관련
Projects
None yet
Development

No branches or pull requests

3 participants