Skip to content

Commit

Permalink
db-modeling4 slackIDをuserテーブルのカラムに追加
Browse files Browse the repository at this point in the history
  • Loading branch information
kmishima16 committed Sep 23, 2024
1 parent 0adaf61 commit dad8c99
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions db_modeling_4/docker-mysql/script/01_DDL.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CREATE TABLE `users` (
`id` int PRIMARY KEY AUTO_INCREMENT,
`account_name` varchar(255) NOT NULL UNIQUE,
`slack_id` varchar(255) NOT NULL UNIQUE,
`created_at` timestamp DEFAULT CURRENT_TIMESTAMP
);

Expand Down
10 changes: 6 additions & 4 deletions db_modeling_4/docker-mysql/script/02_add_reminder.sql
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
-- リマインダーが登録された場合の処理
SET @regist_user_name = 'hogehoge';
SET @regist_user_id = '@hoge_hoge';
SET @receive_user_name = 'kmishima';
SET @receive_user_id = '@k_mishima';

-- 1. usersテーブルの挿入
INSERT INTO users (account_name)
VALUES (@regist_user_name);
INSERT INTO users (account_name, slack_id)
VALUES (@regist_user_name, @regist_user_id);

INSERT INTO users (account_name)
VALUES (@receive_user_name);
INSERT INTO users (account_name, slack_id)
VALUES (@receive_user_name, @receive_user_id);

-- 2. remindersテーブルの挿入
INSERT INTO reminders (regist_user_id, receive_user_id, remind_message, cycle_message)
Expand Down

0 comments on commit dad8c99

Please sign in to comment.