Skip to content

Commit

Permalink
fix: query index 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
DongGeon0908 committed Nov 19, 2024
1 parent 329aa29 commit 97f0c7f
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions sql/group.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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);
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);

0 comments on commit 97f0c7f

Please sign in to comment.