Add: additional DB tables

This commit is contained in:
2018-05-29 15:31:18 +09:00
parent ef2218bfa6
commit a68d18df2d
4 changed files with 154 additions and 24 deletions
+35
View File
@@ -0,0 +1,35 @@
USE jisangs;
INSERT INTO moty_app VALUES
(1, 'korean_basic', 1),
(2, 'korean_left_upper', 1),
(3, 'korean_second_finger', 1),
(4, 'korean_right_upper', 1),
(5, 'korean_left_lower', 1),
(6, 'korean_right_lower', 1),
(7, 'korean_left_upper_double', 1),
(8, 'korean_right_upper_double', 1),
(9, 'korean_word', 1),
(10, 'korean_sentence', 1),
(11, 'english_basic', 1),
(12, 'english_left_upper', 1),
(13, 'english_second_finger', 1),
(14, 'english_right_upper', 1),
(15, 'english_left_lower', 1),
(16, 'english_right_lower', 1),
(19, 'english_word', 1),
(20, 'english_sentence', 1);
INSERT INTO moty_app VALUES
(101, 'space_invaders', 101);
INSERT INTO moty_activate_app VALUES
(1, 1, 1),
(2, 1, 9),
(3, 1, 10),
(4, 1, 19),
(5, 1, 20),
(6, 1, 101);
+65
View File
@@ -0,0 +1,65 @@
CREATE TABLE moty_maestro (
MaestroID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
Name CHAR(50) NOT NULL,
EnterCode CHAR(10) NOT NULL,
Email CHAR(50) NOT NULL,
AccountType INT UNSIGNED NOT NULL,
AccountStatus INT UNSIGNED NOT NULL,
UserCount INT UNSIGNED NOT NULL,
AcceptClausesDateTime DATETIME NOT NULL,
MaestroTestID INT UNSIGNED
);
CREATE TABLE moty_user (
UserID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
MaestroID INT UNSIGNED NOT NULL,
Name CHAR(50) NOT NULL,
EnterCode CHAR(6) NOT NULL
FOREIGN KEY (MaestroID) REFERENCES moty_maestro(MaestroID)
);
CREATE TABLE moty_app (
AppID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
AppName CHAR(40) NOT NULL,
AppType INT UNSIGNED NOT NULL
);
CREATE TABLE moty_activate_app (
ActivateAppID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
MaestroID INT UNSIGNED NOT NULL,
AppID INT UNSIGNED NOT NULL,
FOREIGN KEY (MaestroID) REFERENCES moty_maestro(MaestroID),
FOREIGN KEY (AppID) REFERENCES moty_app(AppID)
);
CREATE TABLE moty_best_record (
BestRecordID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
MaestroID INT UNSIGNED NOT NULL,
AppID INT UNSIGNED NOT NULL,
UserID INT UNSIGNED NOT NULL,
BestRecord FLOAT NOT NULL,
RecordDateTime DATETIME NOT NULL,
FOREIGN KEY (MaestroID) REFERENCES moty_maestro(MaestroID),
FOREIGN KEY (AppID) REFERENCES moty_app(AppID),
FOREIGN KEY (UserID) REFERENCES moty_user(UserID)
);
CREATE TABLE moty_ranking (
RankingID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
MaestroID INT UNSIGNED NOT NULL,
AppID INT UNSIGNED NOT NULL,
RankingType INT UNSIGNED NOT NULL,
Rank INT UNSIGNED NOT NULL,
UserID INT UNSIGNED NOT NULL,
FOREIGN KEY (MaestroID) REFERENCES moty_maestro(MaestroID),
FOREIGN KEY (AppID) REFERENCES moty_app(AppID),
FOREIGN KEY (UserID) REFERENCES moty_user(UserID)
);