💡My project/셸위 : 게임 친구 매칭 사이트

[셸위:게임 친구 매칭 사이트] 6. 1차 기능 구현(2) - 2024.08.26

Song hyun 2024. 8. 26. 20:33
728x90
반응형

[셸위:게임 친구 매칭 사이트] 6. 1차 기능 구현(2) - 2024.08.26

1. DB 테이블 쿼리 삽입 완료

DB 스키마

더보기
-- create database shallwe_db;
-- use shallwe_db;
-- 관리자 테이블
create table admin_tb(
	user_id int primary key auto_increment not null,
    username varchar(20) not null,
    id varchar(20) unique key not null,
    password varchar(20) not null,
    email varchar(50) unique key not null,
    phone_number varchar(20) unique key not null,
    created_at timestamp default now(),
    status int not null -- 0 회원 가입 유지, 1 탈퇴
);

-- 사용자 테이블
create table user_tb(
	user_id int primary key auto_increment not null,
    role_id int not null, -- 직함 id
    username varchar(20) not null,
    id varchar(20) unique key not null,
    password varchar(20) not null,
    nickname varchar(20) not null unique key, 
    birth_date date not null,
    email varchar(50) unique key not null,
    phone_number varchar(20) unique key not null,
    origin_file_name varchar(200) not null,
    upload_file_name varchar(200) not null,
    current_cash bigint not null default 200, -- 캐시, 가입 시 200점
    challenge_point bigint not null default 200, -- 내기 포인트, 가입시 200점 
    created_at timestamp default now(),
    status int not null -- 0 회원 가입 유지, 1 탈퇴
);

-- mbti 테이블
create table mbti_tb(
	id int primary key auto_increment not null,
    name varchar(10) not null,  -- mbti 명
    nickname varchar(20) not null, -- 직업
    content text not null -- mbti 설명
);

-- mbti-user 테이블
create table mbti_user_tb(
	id int primary key auto_increment not null,
    user_id int not null,
    mbti_id int not null
);

-- 신고 테이블
create table report_tb(
	id int primary key not null auto_increment,
    type int not null, -- 어디서 신고했는지
    reason varchar(200) not null, -- 이유
    sender_id int not null, -- 신고한 사람
    reciever_id int not null, -- 신고당한 사람
    created_at timestamp default now() -- 신고 시간
);

-- 장르 테이블
create table genre_tb(
	id int auto_increment primary key,
    genre_name varchar(20)
);

-- 게임 카테고리 테이블
create table game_tb(
	id int primary key not null auto_increment,
    game_name varchar(20) not null,
    genre_id int not null
);

-- 신고 타입 테이블
create table report_type_tb(
	id int primary key not null auto_increment,
    type varchar(20) -- 어디서 신고했는지(유저, 게시글, 댓글, 강의)
);

-- 캐시 사용 타입 테이블
create table cash_type_tb(
	id int primary key auto_increment not null,
    type varchar(10) not null
);

-- 사용자-캐시 히스토리 테이블
create table user_cash_history_tb(
	id int primary key auto_increment not null,
    user_id int not null,
    charge_amount bigint,
    spend_amount bigint,
    created_at Timestamp default now()
);

-- 강의 테이블
create table class_tb(
	id int primary key auto_increment not null,
    title varchar(20) not null,
    content text not null,
    limit_num int,
    current_num int,
    price bigint,
    total_num int,
    status int,
    created_at timestamp default now()
);

-- 강의-강사 테이블
create table class_instructor_tb(
	id int primary key auto_increment not null,
    class_id int,
    instructor_id int
);

-- 강의-수강생 테이블
create table class_student_tb(
	id int primary key auto_increment not null,
    class_id int,
    student_id int,
    num int
);

-- 강의-리뷰 테이블
create table class_review_tb(
	id int primary key auto_increment not null,
    class_id int,
    author_id int,
    comment text,
    grade int,
    created_at timestamp default now()
);

-- 공지사항 테이블
create table notice_tb(
	id int primary key auto_increment not null,
    title varchar(20) not null,
    content text not null,
    author_id int not null,
    created_at timestamp default now()
);

-- 이벤트 테이블
create table event_tb(
	id int primary key auto_increment not null,
    title varchar(20) not null,
    content text not null,
    author_id int not null,
    created_at timestamp default now()
);

-- Q&A 테이블 (질문-유저)
create table qna_question_tb(
	id int primary key auto_increment not null,
    title varchar(20) not null,
    content text not null,
    author_id int not null,
    answer_id int not null,
    created_at timestamp default now()
);

-- Q&A 테이블 (답변-관리자)
create table qna_answer_tb(
	id int primary key auto_increment not null,
    content text not null,
    author_id int not null,
    created_at timestamp default now()
);


-- 커뮤니티 게시판 테이블
create table board_tb (
	id int primary key auto_increment not null,
    category_id int not null,
    title varchar(20) not null,
    content text not null,
    author int not null,
    view_num int default 0,
    good int default 0,
    created_at timestamp default current_timestamp
);
-- 댓글 테이블
create table comment_tb (
	id int primary key auto_increment not null,
    post_id int not null,
    content text not null,
    author int not null,
    created_at timestamp default current_timestamp
);

-- 채팅방 테이블
create table chat_room_tb(
	id int primary key auto_increment not null,
    user_id_1 int not null,
    user_id_2 int not null,
    created_at timestamp default now()
);

-- 광고 테이블
create table advertise_tb(
	id int primary key auto_increment not null,
    place_id int not null,
    title varchar(20),
    customer_id int,
    link text,
    origin_file_name varchar(200),
    upload_file_name varchar(200),
    created_at timestamp default now(),
    start_date timestamp,
    end_date timestamp,
    status int
);

-- 광고 위치 테이블
create table ad_place_tb(
	id int primary key auto_increment not null,
    title varchar(20),
    image_name varchar(200)
);

-- 업적 테이블
create table quest_tb(
	id int primary key auto_increment not null,
    title varchar(50) not null,
    type_id int, -- ex: 게시글 0, 댓글 1
    achievement_num int, -- ex: 달성 조건 = 게시글 30개 (achievement=30)
    title_id int
);

-- 유저-업적 테이블
create table user_quest_tb(
	id int primary key auto_increment not null,
    user_id int not null,
    quest_id int not null,
    current_achievement int
);

-- 칭호 테이블
create table title_tb(
	id int primary key auto_increment not null,
    title varchar(20),
    content text
);

-- 유저-칭호 테이블
create table user_title_tb(
	id int primary key auto_increment not null,
    title_id int,
    user_id int
);

-- 친구 테이블
create table friend_tb(
	id int primary key auto_increment not null,
    user_id int,
    friend_id int
);

-- 명성치 테이블
create table fame_tb(
	id int primary key auto_increment not null,
    sender_id int,
    reciever_id int
);

 

2. 회의

(1) DB 테이블 스키마 설계

-기존: 한 로그인 페이지에서 아이디/비밀번호/role_id(직함)에 따라 메인 페이지/대쉬보드로 나뉨

-변경 시안: 각자 별개의 로그인 페이지에서 아이디/비밀번호 로그인.

로그인 로직이 변경되면서 role_id로 구분짓는 것이 아닌, 처음부터 각자 일반 유저/관리자 테이블에 따로 접근하는 방식으로 변경되었다.

 

(2)  dev1 브랜치 merge 및 새로운 개인 브랜치 생성하기

-오류 없이 수정 완료

+비상용 백업을 위해 직전의 개인 브랜치 1개는 남겨두기로!

 

(3) 각자 작업 진도 이야기하기

-도준영: 로그인 50%

-송원석: 1:1 채팅 기능 70%

-이건우: 대쉬보드 50%

-엄송현: 메인 페이지 배치 완료

-최이제: 게시판 50%

 

(4) 각자의 목표(8.26-8.30)

-도준영: 일반/소셜 로그인 기능 완성

-송원석: 1:1 채팅 기능, 친구 매칭 기능 완성

-이건우: 대쉬보드 완성

-엄송현: 메인 페이지, Mbti 테스트 완성

-최이제: 커뮤니티 게시판 기능 완성

 

728x90
반응형