Skip to content
This repository has been archived by the owner on Nov 25, 2023. It is now read-only.

Commit

Permalink
indexの追加方法を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
sue445 committed Nov 25, 2023
1 parent 84c4243 commit cb68cf6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions sql/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ mysql -u"$ISUCON_DB_USER" \
--port "$ISUCON_DB_PORT" \
"$ISUCON_DB_NAME" < init.sql

mysql -u"$ISUCON_DB_USER" \
-p"$ISUCON_DB_PASSWORD" \
--host "$ISUCON_DB_HOST" \
--port "$ISUCON_DB_PORT" \

mysql -u"$ISUCON_DB_USER" \
-p"$ISUCON_DB_PASSWORD" \
--host "$ISUCON_DB_HOST" \
Expand Down
2 changes: 1 addition & 1 deletion sql/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ ALTER TABLE `reactions` auto_increment = 1;
ALTER TABLE `tags` auto_increment = 1;
ALTER TABLE `livecomments` auto_increment = 1;
ALTER TABLE `livestreams` auto_increment = 1;
ALTER TABLE `users` auto_increment = 1;
ALTER TABLE `users` auto_increment = 1;
4 changes: 0 additions & 4 deletions sql/initdb.d/10_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ CREATE TABLE `themes` (
`dark_mode` BOOLEAN NOT NULL
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;

ALTER TABLE themes ADD INDEX user_id (user_id);

-- ライブ配信
CREATE TABLE `livestreams` (
`id` BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Expand Down Expand Up @@ -60,8 +58,6 @@ CREATE TABLE `livestream_tags` (
`tag_id` BIGINT NOT NULL
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;

ALTER TABLE livestream_tags ADD INDEX livestream_id (livestream_id);

-- ライブ配信視聴履歴
CREATE TABLE `livestream_viewers_history` (
`id` BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Expand Down
5 changes: 5 additions & 0 deletions sql/migrations.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- FIXME: truncateだとindexが消えずに冪等性がないのでここで手動で追加

ALTER TABLE themes ADD INDEX user_id (user_id);

ALTER TABLE livestream_tags ADD INDEX livestream_id (livestream_id);

0 comments on commit cb68cf6

Please sign in to comment.