37 lines
2.3 KiB
SQL
37 lines
2.3 KiB
SQL
-- MySQL 메인 홈 팔로잉 탭 최근 소식 inbox 테이블
|
|
-- 날짜/시간 표시 컬럼은 TIMESTAMP를 사용한다.
|
|
|
|
create table home_following_news_inbox (
|
|
id bigint not null auto_increment comment '팔로잉 최근 소식 inbox ID',
|
|
member_id bigint not null comment '수신 회원 ID(member.id)',
|
|
creator_id bigint not null comment '소식 발신 크리에이터 회원 ID(member.id)',
|
|
news_type varchar(30) not null comment '소식 타입(CREATOR_RANKING, CONTENT_RANKING, COMMUNITY_POST, AUDIO_CONTENT, PHOTO_CONTENT)',
|
|
source_key varchar(200) not null comment '중복 방지용 원천 소식 식별자',
|
|
target_id bigint not null comment '터치 액션 대상 ID',
|
|
occurred_at_utc timestamp not null comment '소식 발생 시각(UTC)',
|
|
visible_from_at_utc timestamp not null comment '소식 노출 시작 시각(UTC)',
|
|
creator_nickname varchar(100) not null comment '소식 생성 시점 크리에이터 닉네임',
|
|
creator_profile_image_path varchar(500) null comment '소식 생성 시점 크리에이터 프로필 이미지 path',
|
|
title varchar(255) not null comment '소식 제목',
|
|
body varchar(1000) not null comment '소식 본문',
|
|
thumbnail_image_path varchar(500) null comment '소식 썸네일 이미지 path',
|
|
rank_no int null comment '랭킹 소식 순위',
|
|
is_adult tinyint(1) not null default 0 comment '성인 콘텐츠 또는 성인 소식 여부',
|
|
is_active tinyint(1) not null default 1 comment '활성 여부',
|
|
created_at timestamp not null default current_timestamp comment '생성 시각',
|
|
updated_at timestamp not null default current_timestamp on update current_timestamp comment '수정 시각',
|
|
primary key (id)
|
|
) engine=InnoDB default charset=utf8mb4 comment='메인 홈 팔로잉 탭 사용자별 최근 소식 inbox';
|
|
|
|
create unique index uk_home_following_news_inbox_member_type_source
|
|
on home_following_news_inbox (member_id, news_type, source_key);
|
|
|
|
create index idx_home_following_news_inbox_member_visible
|
|
on home_following_news_inbox (member_id, is_active, visible_from_at_utc desc, id desc);
|
|
|
|
create index idx_home_following_news_inbox_member_creator_active
|
|
on home_following_news_inbox (member_id, creator_id, is_active);
|
|
|
|
create index idx_home_following_news_inbox_creator_type_source
|
|
on home_following_news_inbox (creator_id, news_type, source_key);
|