-- ----------------------------
-- Table structure for message
-- ----------------------------
CREATE TABLE `Message` (
  `messageId` int(10) unsigned NOT NULL auto_increment,
  `date` datetime NOT NULL,
  `senderId` int(11) unsigned NOT NULL,
  `senderNick` varchar(255) NOT NULL,
  `recipientId` int(11) unsigned default NULL,
  `recipientNick` varchar(255) default NULL,
  `message` text NOT NULL,
  PRIMARY KEY  (`messageId`),
  KEY `senderId` (`senderId`),
  KEY `recipientId` (`recipientId`),
  CONSTRAINT `message_ibfk_1` FOREIGN KEY (`senderId`) REFERENCES `User` (`userId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `message_ibfk_2` FOREIGN KEY (`recipientId`) REFERENCES `User` (`userId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=76 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for user
-- ----------------------------
CREATE TABLE `User` (
  `userId` int(10) unsigned NOT NULL auto_increment,
  `nick` varchar(255) character set utf8 collate utf8_czech_ci NOT NULL,
  `isOnline` tinyint(1) unsigned NOT NULL default '0',
  PRIMARY KEY  (`userId`),
  UNIQUE KEY `nick` (`nick`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;