X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=create_database.sql;h=40a008aadb1caa1654e2b18e4356782ce466e4dd;hp=b480bf3b8b68dcec0df70fcec7a68abdec17dfc0;hb=f2217bfa18ba8a8ab17dd188b38777460ae0590d;hpb=e68d4598c0d0a5e1f138b9c891f5c1c9ae0e8541 diff --git a/create_database.sql b/create_database.sql index b480bf3..40a008a 100644 --- a/create_database.sql +++ b/create_database.sql @@ -12,6 +12,28 @@ /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; + +-- +-- Table structure for table `Version` +-- + +DROP TABLE IF EXISTS `Version`; +CREATE TABLE `Version` ( + `version` int NOT NULL default '0' +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `Card` +-- + + +/*!40000 ALTER TABLE `Card` DISABLE KEYS */; +LOCK TABLES `Version` WRITE; +INSERT INTO `Version` VALUES (1); +UNLOCK TABLES; +/*!40000 ALTER TABLE `Version` ENABLE KEYS */; + + -- -- Table structure for table `Card` -- @@ -48,7 +70,8 @@ CREATE TABLE `Comment` ( `user_id` int(11) default NULL, `play_id` int(11) default NULL, `comment` text, - UNIQUE KEY `id` (`id`) + UNIQUE KEY `id` (`id`), + KEY `play_id` (`play_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- @@ -61,6 +84,30 @@ LOCK TABLES `Comment` WRITE; UNLOCK TABLES; /*!40000 ALTER TABLE `Comment` ENABLE KEYS */; +-- +-- Table structure for table `Notes` +-- + +DROP TABLE IF EXISTS `Notes`; +CREATE TABLE `Notes` ( + `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `create_date` timestamp NOT NULL default '0000-00-00 00:00:00', + `id` int(11) NOT NULL auto_increment, + `user_id` int(11) default NULL, + `game_id` int(11) default NULL, + `comment` text, + UNIQUE KEY `id` (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `Notes` +-- + +/*!40000 ALTER TABLE `Notes` DISABLE KEYS */; +LOCK TABLES `Notes` WRITE; +UNLOCK TABLES; +/*!40000 ALTER TABLE `Notes` ENABLE KEYS */; + -- -- Table structure for table `Game` -- @@ -73,13 +120,14 @@ CREATE TABLE `Game` ( `type` enum('normal','solo','wedding','poverty','dpoverty') default NULL, `solo` enum('trumpless','jack','queen','trump','club','spade','heart','silent') default NULL, `sickness` int(11) default NULL, - `startplayer` tinyint(4) default '1', - `playerid` int(11) default NULL, - `status` enum('pre','play','gameover') default NULL, + `startplayer` tinyint(4) default '1', + `player` int(11) default NULL, + `status` enum('pre','play','gameover','cancel-timedout','cancel-nines','cancel-trump','cancel-noplay') default NULL, `ruleset` int(11) default NULL, `session` int(11) default NULL, `id` int(11) NOT NULL auto_increment, - UNIQUE KEY `id` (`id`) + UNIQUE KEY `id` (`id`), + KEY `session` (`session`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- @@ -107,7 +155,7 @@ CREATE TABLE `Rulesets` ( `id` int(11) NOT NULL auto_increment, UNIQUE KEY `id` (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; - + -- -- Dumping data for table `Rulesets` -- @@ -136,7 +184,9 @@ CREATE TABLE `Hand` ( `sickness` enum('wedding','nines','poverty','solo') default NULL, `solo` enum('trumpless','jack','queen','trump','club','spade','heart','silent') default NULL, `point_call` enum('120','90','60','30','0') default NULL, - UNIQUE KEY `id` (`id`) + UNIQUE KEY `id` (`id`), + KEY `game_id` (`game_id`), + KEY `user_id` (`user_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- @@ -159,7 +209,33 @@ CREATE TABLE `Hand_Card` ( `hand_id` int(11) NOT NULL default '0', `card_id` int(11) NOT NULL default '0', `played` enum('true','false') default 'false', - UNIQUE KEY `id` (`id`) + UNIQUE KEY `id` (`id`), + KEY `hand_id` (`hand_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `Hand_Card` +-- + + +/*!40000 ALTER TABLE `Hand_Card` DISABLE KEYS */; +LOCK TABLES `Hand_Card` WRITE; +UNLOCK TABLES; +/*!40000 ALTER TABLE `Hand_Card` ENABLE KEYS */; + +-- +-- Table structure for table `Card_Exchange` +-- + +DROP TABLE IF EXISTS `Card_Exchange`; +CREATE TABLE `Card_Exchange` ( + `id` int(11) NOT NULL auto_increment, + `orig_hand_id` int(11) NOT NULL default '0', + `new_hand_id` int(11) NOT NULL default '0', + `card_id` int(11) NOT NULL default '0', + UNIQUE KEY `id` (`id`), + KEY `orig_hand_id` (`orig_hand_id`), + KEY `new_hand_id` (`new_hand_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- @@ -172,6 +248,7 @@ LOCK TABLES `Hand_Card` WRITE; UNLOCK TABLES; /*!40000 ALTER TABLE `Hand_Card` ENABLE KEYS */; + -- -- Table structure for table `Play` -- @@ -184,7 +261,8 @@ CREATE TABLE `Play` ( `trick_id` int(11) NOT NULL default '0', `hand_card_id` int(11) NOT NULL default '0', `sequence` tinyint(4) NOT NULL default '0', - UNIQUE KEY `id` (`id`) + UNIQUE KEY `id` (`id`), + KEY `trick_id` (`trick_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- @@ -204,10 +282,17 @@ UNLOCK TABLES; DROP TABLE IF EXISTS `Score`; CREATE TABLE `Score` ( `id` int(11) NOT NULL auto_increment, + `create_date` timestamp NOT NULL default '0000-00-00 00:00:00', `game_id` int(11) NOT NULL default '0', - `hand_id` int(11) NOT NULL default '0', - `score` tinyint(4) default NULL, - UNIQUE KEY `id` (`id`) + `party` enum('re','contra') default NULL , + `winner_id` int(11) default NULL , + `looser_id` int(11) default NULL , + `score` enum('120', 'call120','against120','90','call90','against90','made90', + '60','call60','against60','made60','30','call30','against30','made30', + '0','call0','against0','made0', + 'fox','karlchen','dulle','doko','againstqueens') default NULL, + UNIQUE KEY `id` (`id`), + KEY `game_id` (`game_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- @@ -230,7 +315,9 @@ CREATE TABLE `Trick` ( `create_date` timestamp NOT NULL default '0000-00-00 00:00:00', `id` int(11) NOT NULL auto_increment, `game_id` int(11) NOT NULL default '0', - UNIQUE KEY `id` (`id`) + `winner` tinyint(4) default NULL, + UNIQUE KEY `id` (`id`), + KEY `game_id` (`game_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- @@ -253,8 +340,9 @@ CREATE TABLE `User` ( `fullname` varchar(64) default NULL, `email` varchar(64) default NULL, `password` varchar(32) default NULL, - `timezone` tinyint(2) default NULL, + `timezone` varchar(64) default 'Europe/London', `last_login` timestamp NOT NULL default '0000-00-00 00:00:00', + `create_date` timestamp NOT NULL default '0000-00-00 00:00:00', UNIQUE KEY `id` (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; @@ -279,7 +367,8 @@ CREATE TABLE `User_Game_Prefs` ( `game_id` int(11) NOT NULL default '0', `pref_key` varchar(64) default NULL, `value` varchar(64) default NULL, - UNIQUE KEY `id` (`id`) + UNIQUE KEY `id` (`id`), + KEY `user_id` (`user_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- @@ -302,7 +391,8 @@ CREATE TABLE `User_Prefs` ( `user_id` int(11) NOT NULL default '0', `pref_key` varchar(64) default NULL, `value` varchar(64) default NULL, - UNIQUE KEY `id` (`id`) + UNIQUE KEY `id` (`id`), + KEY `user_id` (`user_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- @@ -310,10 +400,55 @@ CREATE TABLE `User_Prefs` ( -- -/*!40000 ALTER TABLE `User_Prefs` DISABLE KEYS */; -LOCK TABLES `User_Prefs` WRITE; + + +/*!40000 ALTER TABLE `Recovery` DISABLE KEYS */; +LOCK TABLES `Recovery` WRITE; UNLOCK TABLES; -/*!40000 ALTER TABLE `User_Prefs` ENABLE KEYS */; +/*!40000 ALTER TABLE `Recovery` ENABLE KEYS */; + + +DROP TABLE IF EXISTS `Recovery`; +CREATE TABLE `Recovery` ( + `id` int(11) NOT NULL auto_increment, + `user_id` int(11) NOT NULL default '0', + `password` varchar(32) default NULL, + `create_date` timestamp NOT NULL default '0000-00-00 00:00:00', + UNIQUE KEY `id` (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `Recovery` +-- + +/*!40000 ALTER TABLE `Recovery` DISABLE KEYS */; +LOCK TABLES `Recovery` WRITE; +UNLOCK TABLES; +/*!40000 ALTER TABLE `Recovery` ENABLE KEYS */; + +/*!40000 ALTER TABLE `Reminder` DISABLE KEYS */; +LOCK TABLES `Reminder` WRITE; +UNLOCK TABLES; +/*!40000 ALTER TABLE `Reminder` ENABLE KEYS */; + +DROP TABLE IF EXISTS `Reminder`; +CREATE TABLE `Reminder` ( + `id` int(11) NOT NULL auto_increment, + `user_id` int(11) NOT NULL default '0', + `game_id` int(11) NOT NULL default '0', + `create_date` timestamp NOT NULL default '0000-00-00 00:00:00', + UNIQUE KEY `id` (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `Reminder` +-- + +/*!40000 ALTER TABLE `Reminder` DISABLE KEYS */; +LOCK TABLES `Reminder` WRITE; +UNLOCK TABLES; +/*!40000 ALTER TABLE `Reminder` ENABLE KEYS */; + /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; @@ -322,3 +457,23 @@ UNLOCK TABLES; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +DROP TABLE IF EXISTS `user_openids`; +create table user_openids ( + openid_url varchar(255) not null, + primary key (openid_url), + + user_id int not null, + index (user_id) +); + +DROP TABLE IF EXISTS `digest_email`; +create table digest_email ( + `id` int(11) NOT NULL auto_increment, + `email` varchar(255) default null, + `create_date` timestamp NOT NULL default '0000-00-00 00:00:00', + `content` text, + UNIQUE KEY `id` (`id`), + index (email) +); + +