From 97f0c7fbbbeb31439cc3cc571a2d184106890eeb Mon Sep 17 00:00:00 2001 From: DongGeon0908 Date: Tue, 19 Nov 2024 09:29:43 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20query=20index=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/group.sql | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/sql/group.sql b/sql/group.sql index f8000f7..46a3624 100644 --- a/sql/group.sql +++ b/sql/group.sql @@ -50,22 +50,23 @@ CREATE INDEX idx__uid ON group_user_score (uid); -- 그룹 태그 CREATE TABLE `group_tag` ( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'group tag id', - `name` varchar(30) NOT NULL COMMENT '태그명', - `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', - `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'group tag id', + `name` varchar(30) 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__group_tag_name ON group_tag (name); +CREATE UNIQUE INDEX uidx__name ON group_tag (name); -- 그룹 태그 매핑 CREATE TABLE `group_tag_map` ( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'group tag map id', - `group_id` bigint NOT NULL COMMENT 'group id', - `tag_id` bigint NOT NULL COMMENT 'group tag id', - `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', - `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'group tag map id', + `group_id` bigint NOT NULL COMMENT 'group id', + `tag_id` bigint NOT NULL COMMENT 'group tag 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='그룹 태그 매핑'; -CREATE UNIQUE INDEX uidx__group_id__tag_id ON group_tag_map (group_id, tag_id); \ No newline at end of file +CREATE UNIQUE INDEX uidx__group_id__tag_id ON group_tag_map (group_id, tag_id); +CREATE INDEX idx__tag_id ON group_tag_map (tag_id);