ODY_ERD

Tables (10)

follows (follow)

  • id — BIGINT — Primary key — NOT NULL — 팔로우 ID
  • follower_email — VARCHAR(255) — Foreign key → users.email — NOT NULL — users.email, 팔로우를 하는 쪽
  • followee_email — VARCHAR(255) — Foreign key → users.email — NOT NULL — users.email, 팔로우를 받는 쪽
  • created_at — TIMESTAMPTZ — NOT NULL — 팔로우 시각

genres (genre)

  • id — BIGINT — Primary key — NOT NULL — 장르 ID
  • name — VARCHAR(100) — NOT NULL — 장르명

meeting

  • user1 — VARCHAR(255) — Foreign key → users.email — NOT NULL — users.email, 사전순 앞
  • user2 — VARCHAR(255) — Foreign key → users.email — NOT NULL — users.email, 사전순 뒤
  • cnt — INT — NOT NULL — 누적 만남 횟수

music_genres (music_genre)

  • id — BIGINT — Primary key — NOT NULL
  • music_id — BIGINT — Foreign key → musics.id — NOT NULL — 곡 ID
  • genre_id — BIGINT — Foreign key → genres.id — NOT NULL — 장르 ID

musics (music)

  • id — BIGINT — Primary key — NOT NULL — 곡 ID
  • mbid — VARCHAR(64) — NOT NULL — MusicBrainz recording MBID(36자 UUID) 또는 SHA-1 경로 해시 폴백(40자)
  • title — VARCHAR(200) — NOT NULL — 곡명
  • artist — VARCHAR(500) — 아티스트명
  • release_year — SMALLINT — 발매 연도
  • bpm — NUMERIC(5,1) — BPM, 소수 1자리
  • duration — INT — 재생 길이(초)
  • album — VARCHAR(200)
  • youtube_url — TEXT — YouTube 재생 URL, NULL이면 재생 불가
  • location — VECTOR(16) — PCA 임베딩 좌표 pc1~pc16
  • play_cnt — INT — NOT NULL — 누적 재생 수, 배치 갱신
  • youtube_cnt — INT — NOT NULL — 매핑된 YouTube 후보 영상 수

play_histories (play_history)

  • id — BIGINT — Primary key — NOT NULL — 재생 로그 ID
  • music_id — BIGINT — Foreign key → musics.id — NOT NULL — musics.id
  • email — VARCHAR(255) — Foreign key → users.email — users.email, 탈퇴 시 NULL(익명화)
  • source — VARCHAR(20) — NOT NULL — MAP / JOURNEY / PLAYLIST / FOLLOW
  • played_ms — INT — NOT NULL — 재생 시간(ms)
  • played_at — TIMESTAMPTZ — NOT NULL — 재생 시각

playlist_items (playlist_item)

  • playlist_id — BIGINT — Foreign key → playlists.id — NOT NULL — 플레이리스트 ID
  • music_id — BIGINT — Foreign key → musics.id — NOT NULL — 곡 ID
  • added_at — TIMESTAMPTZ — NOT NULL — 추가 시각

playlists (playlist)

  • id — BIGINT — Primary key — NOT NULL — 플레이리스트 ID
  • email — VARCHAR(255) — Foreign key → users.email — NOT NULL — users.email, 소유자
  • playlist_name — VARCHAR(200) — NOT NULL — 플레이리스트명, 소유자 내 유일
  • like_cnt — INT
  • created_at — TIMESTAMPTZ — NOT NULL — 생성 시각
  • updated_at — TIMESTAMPTZ — NOT NULL — 수정 시각, 이름 변경/곡 추가 시 갱신

refresh_tokens (refresh_token)

  • id — BIGINT — Primary key — NOT NULL
  • email — VARCHAR(255) — Foreign key → users.email — NOT NULL
  • token_hash — CHAR(64) — NOT NULL — 리프레시 토큰 SHA-256 hex(64자)
  • device_id — VARCHAR(100) — NOT NULL — 디바이스 식별자, 멀티 세션 구분
  • expires_at — TIMESTAMPTZ — NOT NULL — 리프레시 토큰 만료
  • created_at — TIMESTAMPTZ — NOT NULL
  • updated_at — TIMESTAMPTZ — NOT NULL — 갱신 시각

users (user)

  • email — VARCHAR(255) — Primary key — NOT NULL — PK, 구글 계정 이메일
  • name — VARCHAR(100) — 구글 표시명
  • nickname — VARCHAR(100) — 온보딩에서 설정, 2~20자
  • is_public — BOOLEAN — NOT NULL — 공개 계정 여부, 비공개면 따라가기 불가
  • last_active_at — TIMESTAMPTZ — 최근 활동 시각
  • created_at — TIMESTAMPTZ — NOT NULL — 가입 시각
  • updated_at — TIMESTAMPTZ — NOT NULL — 수정 시각
  • image_url — VARCHAR(512)
  • tutorial_completed — BOOLEAN