DROP TABLE IF EXISTS `messages`;
CREATE TABLE  `messages` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `data` varchar(150) NOT NULL,
  `type` varchar(9) NOT NULL,
  `from` varchar(45) NOT NULL,
  `timestamp` bigint(20) unsigned NOT NULL,
  `toType` enum('user','salle') NOT NULL,
  `to` varchar(45) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `occupation`;
CREATE TABLE  `occupation` (
  `salleID` int(10) unsigned NOT NULL,
  `utilisateurID` int(10) unsigned NOT NULL,
  PRIMARY KEY  (`salleID`,`utilisateurID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `salles`;
CREATE TABLE  `salles` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `nom` varchar(45) NOT NULL,
  `flags` varchar(26) NOT NULL,
  `password` varchar(32) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `utilisateurs`;
CREATE TABLE  `utilisateurs` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `nom` varchar(45) NOT NULL,
  `flags` varchar(26) NOT NULL,
  `lastping` int(10) unsigned NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `nsutilisateurs`;
CREATE TABLE  `nsutilisateurs` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `nom` varchar(45) NOT NULL,
  `password` varchar(32) NOT NULL,
  `flags` varchar(26) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;