youtube upload 기능 작성 .
This commit is contained in:
1 parent
ef203dc14d
commit
8c7893d989
8 files changed
+330
-27
No files matched your search
@@ -0,0 +1,58 @@
|
||||
-- ===================================================================
|
||||
-- social_upload 테이블 생성 마이그레이션
|
||||
-- 소셜 미디어 업로드 기록을 저장하는 테이블
|
||||
-- 생성일: 2026-02-02
|
||||
-- ===================================================================
|
||||
|
||||
-- social_upload 테이블 생성
|
||||
CREATE TABLE IF NOT EXISTS social_upload (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '고유 식별자',
|
||||
|
||||
-- 관계 필드
|
||||
user_uuid VARCHAR(36) NOT NULL COMMENT '사용자 UUID (User.user_uuid 참조)',
|
||||
video_id INT NOT NULL COMMENT 'Video 외래키',
|
||||
social_account_id INT NOT NULL COMMENT 'SocialAccount 외래키',
|
||||
|
||||
-- 플랫폼 정보
|
||||
platform VARCHAR(20) NOT NULL COMMENT '플랫폼 구분 (youtube, instagram, facebook, tiktok)',
|
||||
|
||||
-- 업로드 상태
|
||||
status VARCHAR(20) NOT NULL DEFAULT 'pending' COMMENT '업로드 상태 (pending, uploading, processing, completed, failed)',
|
||||
upload_progress INT NOT NULL DEFAULT 0 COMMENT '업로드 진행률 (0-100)',
|
||||
|
||||
-- 플랫폼 결과
|
||||
platform_video_id VARCHAR(100) NULL COMMENT '플랫폼에서 부여한 영상 ID',
|
||||
platform_url VARCHAR(500) NULL COMMENT '플랫폼에서의 영상 URL',
|
||||
|
||||
-- 메타데이터
|
||||
title VARCHAR(200) NOT NULL COMMENT '영상 제목',
|
||||
description TEXT NULL COMMENT '영상 설명',
|
||||
tags JSON NULL COMMENT '태그 목록 (JSON 배열)',
|
||||
privacy_status VARCHAR(20) NOT NULL DEFAULT 'private' COMMENT '공개 상태 (public, unlisted, private)',
|
||||
platform_options JSON NULL COMMENT '플랫폼별 추가 옵션 (JSON)',
|
||||
|
||||
-- 에러 정보
|
||||
error_message TEXT NULL COMMENT '에러 메시지 (실패 시)',
|
||||
retry_count INT NOT NULL DEFAULT 0 COMMENT '재시도 횟수',
|
||||
|
||||
-- 시간 정보
|
||||
uploaded_at DATETIME NULL COMMENT '업로드 완료 시간',
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '생성 일시',
|
||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정 일시',
|
||||
|
||||
-- 외래키 제약조건
|
||||
CONSTRAINT fk_social_upload_user FOREIGN KEY (user_uuid) REFERENCES user(user_uuid) ON DELETE CASCADE,
|
||||
CONSTRAINT fk_social_upload_video FOREIGN KEY (video_id) REFERENCES video(id) ON DELETE CASCADE,
|
||||
CONSTRAINT fk_social_upload_account FOREIGN KEY (social_account_id) REFERENCES social_account(id) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='소셜 미디어 업로드 기록 테이블';
|
||||
|
||||
-- 인덱스 생성
|
||||
CREATE INDEX idx_social_upload_user_uuid ON social_upload(user_uuid);
|
||||
CREATE INDEX idx_social_upload_video_id ON social_upload(video_id);
|
||||
CREATE INDEX idx_social_upload_social_account_id ON social_upload(social_account_id);
|
||||
CREATE INDEX idx_social_upload_platform ON social_upload(platform);
|
||||
CREATE INDEX idx_social_upload_status ON social_upload(status);
|
||||
CREATE INDEX idx_social_upload_created_at ON social_upload(created_at);
|
||||
|
||||
-- 유니크 인덱스 (동일 영상 + 동일 계정 조합은 하나만 존재)
|
||||
CREATE UNIQUE INDEX uq_social_upload_video_platform ON social_upload(video_id, social_account_id);
|
||||
Reference in new issue
Block a user