From 61c10c4c9c0e28bf988945cbcc86f160007c58bf Mon Sep 17 00:00:00 2001 From: DongGeon0908 Date: Wed, 21 Aug 2024 11:33:09 +0900 Subject: [PATCH] =?UTF-8?q?imp:=20sql=20scripts=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/DDL.sql | 193 --------------------------------------------- sql/discussion.sql | 28 +++++++ sql/group.sql | 48 +++++++++++ sql/pose.sql | 75 ++++++++++++++++++ sql/user.sql | 38 +++++++++ 5 files changed, 189 insertions(+), 193 deletions(-) create mode 100644 sql/discussion.sql create mode 100644 sql/group.sql create mode 100644 sql/pose.sql create mode 100644 sql/user.sql diff --git a/sql/DDL.sql b/sql/DDL.sql index 496d93e..296e3f9 100644 --- a/sql/DDL.sql +++ b/sql/DDL.sql @@ -2,122 +2,6 @@ CREATE DATABASE hero CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; --- 유저 정보 -CREATE TABLE `user_info` -( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'user id', - `nickname` varchar(64) NOT NULL COMMENT '닉네임', - `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', - `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=200000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='유저 정보'; -CREATE UNIQUE INDEX uidx__nickname ON user_info (nickname); - --- 일반 회원가입 유저 정보 -CREATE TABLE `credential_user_info` -( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'credential_user_info id', - `uid` bigint NOT NULL COMMENT 'user id', - `username` varchar(256) NOT NULL COMMENT '로그인 id', - `password` varchar(512) NOT NULL COMMENT '로그인 pw', - `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', - `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=200000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='유저 정보'; -CREATE UNIQUE INDEX uidx__uid ON credential_user_info (uid); -CREATE UNIQUE INDEX uidx__username ON credential_user_info (username); - --- OAuth 회원가입 유저 정보 -CREATE TABLE `oauth_user_info` -( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'oauth user info id', - `uid` bigint NOT NULL COMMENT 'user id', - `provider` varchar(32) NOT NULL COMMENT 'oauth provider', - `oauth_id` varchar(512) NOT NULL COMMENT 'oauth id', - `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', - `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=200000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='oauth 유저 정보'; -CREATE UNIQUE INDEX uidx__uid__provider ON oauth_user_info (uid, provider); -CREATE INDEX idx__oauth_id__provider ON oauth_user_info (oauth_id, provider); - --- 그룹 -CREATE TABLE `group` -( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'group id', - `name` varchar(32) NOT NULL COMMENT '그룹명', - `description` varchar(512) DEFAULT NULL COMMENT '그룹 설명', - `owner_uid` bigint NOT NULL COMMENT 'owner uid', - `is_hidden` tinyint NOT NULL DEFAULT 0 COMMENT '숨김 여부', - `join_code` varchar(128) DEFAULT NULL COMMENT '참여코드', - `user_count` int NOT NULL DEFAULT 1 COMMENT '그룹원 수', - `user_capacity` int NOT NULL DEFAULT 0 COMMENT '그룹원 정원', - `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', - `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=200000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='그룹'; - -CREATE UNIQUE INDEX uidx__name ON `group` (name); -CREATE INDEX idx__owner_uid ON `group` (owner_uid); -CREATE INDEX idx__join_code ON `group` (join_code); - --- 그룹 유저 -CREATE TABLE `group_user` -( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'group user id', - `group_id` bigint NOT NULL COMMENT 'group id', - `uid` bigint NOT NULL COMMENT 'uid', - `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', - `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=200000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='그룹 유저'; -CREATE UNIQUE INDEX uidx__group_id__uid ON group_user (group_id, uid); -CREATE INDEX idx__uid ON group_user (uid); - --- 그룹 유저 스코어 -CREATE TABLE `group_user_score` -( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'group user score id', - `group_id` bigint NOT NULL COMMENT 'group id', - `group_user_id` bigint NOT NULL COMMENT 'group user id', - `uid` bigint NOT NULL COMMENT 'uid', - `score` int DEFAULT NULL COMMENT '스코어', - `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', - `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=200000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='그룹 유저 스코어'; -CREATE UNIQUE INDEX uidx__group_user_id ON group_user_score (group_user_id); -CREATE INDEX idx__group_id__group_user_id ON group_user_score (group_id, group_user_id); -CREATE INDEX idx__uid ON group_user_score (uid); - --- 포즈 스냅샵 -CREATE TABLE `pose_snapshot` -( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'pose snapshot id', - `uid` bigint NOT NULL COMMENT 'uid', - `score` DECIMAL(20, 16) NOT NULL COMMENT '포즈 신뢰도 종합', - `type` VARCHAR(32) NOT NULL COMMENT '포즈 타입', - `image_url` VARCHAR(512) NOT NULL COMMENT '포즈 이미지 url', - `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', - `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='포즈 스냅샷'; -CREATE INDEX idx__uid ON pose_snapshot (uid); -CREATE INDEX idx__created_at ON pose_snapshot (created_at); - --- 포즈 key point 스냅샷 -CREATE TABLE `pose_key_point_snapshot` -( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'pose key point snapshot id', - `pose_snapshot_id` bigint NOT NULL COMMENT 'post snapshot id', - `position` VARCHAR(32) NOT NULL COMMENT '스냅샷 위치', - `x` DECIMAL(20, 16) NOT NULL COMMENT 'x 좌표', - `y` DECIMAL(20, 16) NOT NULL COMMENT 'y 좌표', - `confidence` DECIMAL(20, 16) NOT NULL COMMENT '신뢰도' - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='포즈 key point'; -CREATE INDEX uidx__pose_snapshot_id__position ON pose_key_point_snapshot (pose_snapshot_id, position); - -- system log CREATE TABLE `system_action_log` ( @@ -147,80 +31,3 @@ CREATE TABLE `image_metadata` PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=200000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; CREATE INDEX idx__uid__type ON image_metadata (uid, type); - --- 문의하기 -CREATE TABLE `discussion` -( - `id` bigint NOT NULL AUTO_INCREMENT, - `uid` bigint NOT NULL COMMENT 'uid', - `type` varchar(32) NOT NULL COMMENT '문의하기 유형', - `title` varchar(512) NOT NULL COMMENT '문의하기 제목', - `content` text NOT NULL COMMENT '문의하기 본문', - `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', - `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=200000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -CREATE INDEX idx__uid ON discussion (uid); - --- 문의하기 답변 -CREATE TABLE `discussion_comment` -( - `id` bigint NOT NULL AUTO_INCREMENT, - `uid` bigint NOT NULL COMMENT 'uid', - `discussion_id` bigint NOT NULL COMMENT 'discussion_id', - `title` varchar(512) NOT NULL COMMENT '답변 제목', - `content` text NOT NULL COMMENT '답변 본문', - `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', - `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=200000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -CREATE INDEX idx__discussion_id ON discussion_comment (discussion_id); -CREATE INDEX idx__uid ON discussion_comment (uid); - --- 포즈 카운트 집계 -CREATE TABLE `pose_count` -( - `id` bigint NOT NULL AUTO_INCREMENT, - `uid` bigint NOT NULL COMMENT 'uid', - `total_count` text NOT NULL COMMENT '집계 데이터', - `date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '기준 날짜', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -CREATE INDEX idx__uid__date ON pose_count (uid, date); -CREATE INDEX idx__date ON pose_count (date); - --- 자세 알림 -CREATE TABLE `pose_noti` -( - `id` bigint NOT NULL AUTO_INCREMENT, - `uid` bigint NOT NULL COMMENT 'uid', - `is_active` tinyint NOT NULL DEFAULT 0 COMMENT '활성화 여부', - `duration` varchar(32) NOT NULL COMMENT '알림 주기', - `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', - `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT '자세 알림'; -CREATE INDEX uidx__uid ON pose_noti (uid); - --- 포즈 레이아웃 -CREATE TABLE `pose_layout` -( - `id` bigint NOT NULL AUTO_INCREMENT, - `uid` bigint NOT NULL COMMENT 'uid', - `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', - `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT '포즈 레이아웃'; -CREATE INDEX idx__uid ON pose_layout (uid); - --- 포즈 레이아웃 포인트 -CREATE TABLE `pose_layout_point` -( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'pose key point snapshot id', - `pose_layout_id` bigint NOT NULL COMMENT 'pose layout id', - `position` VARCHAR(32) NOT NULL COMMENT '스냅샷 위치', - `x` DECIMAL(20, 16) NOT NULL COMMENT 'x 좌표', - `y` DECIMAL(20, 16) NOT NULL COMMENT 'y 좌표', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='포즈 레이아웃 point'; -CREATE INDEX uidx__pose_snapshot_id__position ON pose_layout_point (pose_layout_id, position); diff --git a/sql/discussion.sql b/sql/discussion.sql new file mode 100644 index 0000000..05d079e --- /dev/null +++ b/sql/discussion.sql @@ -0,0 +1,28 @@ +-- 문의하기 +CREATE TABLE `discussion` +( + `id` bigint NOT NULL AUTO_INCREMENT, + `uid` bigint NOT NULL COMMENT 'uid', + `type` varchar(32) NOT NULL COMMENT '문의하기 유형', + `title` varchar(512) NOT NULL COMMENT '문의하기 제목', + `content` text NOT NULL COMMENT '문의하기 본문', + `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', + `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=200000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +CREATE INDEX idx__uid ON discussion (uid); + +-- 문의하기 답변 +CREATE TABLE `discussion_comment` +( + `id` bigint NOT NULL AUTO_INCREMENT, + `uid` bigint NOT NULL COMMENT 'uid', + `discussion_id` bigint NOT NULL COMMENT 'discussion_id', + `title` varchar(512) NOT NULL COMMENT '답변 제목', + `content` text NOT NULL COMMENT '답변 본문', + `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', + `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=200000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +CREATE INDEX idx__discussion_id ON discussion_comment (discussion_id); +CREATE INDEX idx__uid ON discussion_comment (uid); diff --git a/sql/group.sql b/sql/group.sql new file mode 100644 index 0000000..d2f25e6 --- /dev/null +++ b/sql/group.sql @@ -0,0 +1,48 @@ +-- 그룹 +CREATE TABLE `group` +( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'group id', + `name` varchar(32) NOT NULL COMMENT '그룹명', + `description` varchar(512) DEFAULT NULL COMMENT '그룹 설명', + `owner_uid` bigint NOT NULL COMMENT 'owner uid', + `is_hidden` tinyint NOT NULL DEFAULT 0 COMMENT '숨김 여부', + `join_code` varchar(128) DEFAULT NULL COMMENT '참여코드', + `user_count` int NOT NULL DEFAULT 1 COMMENT '그룹원 수', + `user_capacity` int NOT NULL DEFAULT 0 COMMENT '그룹원 정원', + `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', + `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=200000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='그룹'; + +CREATE UNIQUE INDEX uidx__name ON `group` (name); +CREATE INDEX idx__owner_uid ON `group` (owner_uid); +CREATE INDEX idx__join_code ON `group` (join_code); + +-- 그룹 유저 +CREATE TABLE `group_user` +( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'group user id', + `group_id` bigint NOT NULL COMMENT 'group id', + `uid` bigint NOT NULL COMMENT 'uid', + `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', + `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=200000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='그룹 유저'; +CREATE UNIQUE INDEX uidx__group_id__uid ON group_user (group_id, uid); +CREATE INDEX idx__uid ON group_user (uid); + +-- 그룹 유저 스코어 +CREATE TABLE `group_user_score` +( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'group user score id', + `group_id` bigint NOT NULL COMMENT 'group id', + `group_user_id` bigint NOT NULL COMMENT 'group user id', + `uid` bigint NOT NULL COMMENT 'uid', + `score` int DEFAULT NULL COMMENT '스코어', + `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', + `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=200000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='그룹 유저 스코어'; +CREATE UNIQUE INDEX uidx__group_user_id ON group_user_score (group_user_id); +CREATE INDEX idx__group_id__group_user_id ON group_user_score (group_id, group_user_id); +CREATE INDEX idx__uid ON group_user_score (uid); diff --git a/sql/pose.sql b/sql/pose.sql new file mode 100644 index 0000000..053e47e --- /dev/null +++ b/sql/pose.sql @@ -0,0 +1,75 @@ +-- 포즈 스냅샵 +CREATE TABLE `pose_snapshot` +( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'pose snapshot id', + `uid` bigint NOT NULL COMMENT 'uid', + `score` DECIMAL(20, 16) NOT NULL COMMENT '포즈 신뢰도 종합', + `type` VARCHAR(32) NOT NULL COMMENT '포즈 타입', + `image_url` VARCHAR(512) NOT NULL COMMENT '포즈 이미지 url', + `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', + `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='포즈 스냅샷'; +CREATE INDEX idx__uid ON pose_snapshot (uid); +CREATE INDEX idx__created_at ON pose_snapshot (created_at); + +-- 포즈 key point 스냅샷 +CREATE TABLE `pose_key_point_snapshot` +( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'pose key point snapshot id', + `pose_snapshot_id` bigint NOT NULL COMMENT 'post snapshot id', + `position` VARCHAR(32) NOT NULL COMMENT '스냅샷 위치', + `x` DECIMAL(20, 16) NOT NULL COMMENT 'x 좌표', + `y` DECIMAL(20, 16) NOT NULL COMMENT 'y 좌표', + `confidence` DECIMAL(20, 16) NOT NULL COMMENT '신뢰도' + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='포즈 key point'; +CREATE INDEX uidx__pose_snapshot_id__position ON pose_key_point_snapshot (pose_snapshot_id, position); + +-- 포즈 카운트 집계 +CREATE TABLE `pose_count` +( + `id` bigint NOT NULL AUTO_INCREMENT, + `uid` bigint NOT NULL COMMENT 'uid', + `total_count` text NOT NULL COMMENT '집계 데이터', + `date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '기준 날짜', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +CREATE INDEX idx__uid__date ON pose_count (uid, date); +CREATE INDEX idx__date ON pose_count (date); + +-- 자세 알림 +CREATE TABLE `pose_noti` +( + `id` bigint NOT NULL AUTO_INCREMENT, + `uid` bigint NOT NULL COMMENT 'uid', + `is_active` tinyint NOT NULL DEFAULT 0 COMMENT '활성화 여부', + `duration` varchar(32) NOT NULL COMMENT '알림 주기', + `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', + `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT '자세 알림'; +CREATE INDEX uidx__uid ON pose_noti (uid); + +-- 포즈 레이아웃 +CREATE TABLE `pose_layout` +( + `id` bigint NOT NULL AUTO_INCREMENT, + `uid` bigint NOT NULL COMMENT 'uid', + `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', + `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT '포즈 레이아웃'; +CREATE INDEX idx__uid ON pose_layout (uid); + +-- 포즈 레이아웃 포인트 +CREATE TABLE `pose_layout_point` +( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'pose key point snapshot id', + `pose_layout_id` bigint NOT NULL COMMENT 'pose layout id', + `position` VARCHAR(32) NOT NULL COMMENT '스냅샷 위치', + `x` DECIMAL(20, 16) NOT NULL COMMENT 'x 좌표', + `y` DECIMAL(20, 16) NOT NULL COMMENT 'y 좌표', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='포즈 레이아웃 point'; +CREATE INDEX uidx__pose_snapshot_id__position ON pose_layout_point (pose_layout_id, position); diff --git a/sql/user.sql b/sql/user.sql new file mode 100644 index 0000000..a993c89 --- /dev/null +++ b/sql/user.sql @@ -0,0 +1,38 @@ +-- 유저 정보 +CREATE TABLE `user_info` +( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'user id', + `nickname` varchar(64) NOT NULL COMMENT '닉네임', + `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', + `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=200000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='유저 정보'; +CREATE UNIQUE INDEX uidx__nickname ON user_info (nickname); + +-- 일반 회원가입 유저 정보 +CREATE TABLE `credential_user_info` +( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'credential_user_info id', + `uid` bigint NOT NULL COMMENT 'user id', + `username` varchar(256) NOT NULL COMMENT '로그인 id', + `password` varchar(512) NOT NULL COMMENT '로그인 pw', + `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', + `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=200000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='유저 정보'; +CREATE UNIQUE INDEX uidx__uid ON credential_user_info (uid); +CREATE UNIQUE INDEX uidx__username ON credential_user_info (username); + +-- OAuth 회원가입 유저 정보 +CREATE TABLE `oauth_user_info` +( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'oauth user info id', + `uid` bigint NOT NULL COMMENT 'user id', + `provider` varchar(32) NOT NULL COMMENT 'oauth provider', + `oauth_id` varchar(512) NOT NULL COMMENT 'oauth id', + `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', + `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=200000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='oauth 유저 정보'; +CREATE UNIQUE INDEX uidx__uid__provider ON oauth_user_info (uid, provider); +CREATE INDEX idx__oauth_id__provider ON oauth_user_info (oauth_id, provider);