-- http://www.phpmyadmin.net
--
-- Serveur: localhost
-- Généré le : Jeu 26 Janvier 2012 à 23:42
-- Version du serveur: 5.1.49
-- Version de PHP: 5.3.3-7+squeeze3

START TRANSACTION;



--
-- Base de données: `zt`
--

-- --------------------------------------------------------

--
-- Structure de la table `cat`
--

CREATE TABLE IF NOT EXISTS `cat` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `titre` varchar(45) NOT NULL,
  `image` varchar(255) DEFAULT NULL,
  `root_id` bigint(20) DEFAULT NULL,
  `lft` int(11) DEFAULT NULL,
  `rgt` int(11) DEFAULT NULL,
  `level` smallint(6) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Structure de la table `ddl`
--

CREATE TABLE IF NOT EXISTS `ddl` (
  `idddl` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `cat` int(10) unsigned DEFAULT NULL,
  `titre` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `description` text COLLATE utf8_unicode_ci NOT NULL,
  `url` text COLLATE utf8_unicode_ci NOT NULL,
  `taille` bigint(20) unsigned DEFAULT NULL,
  `auteur` int(10) unsigned DEFAULT NULL,
  `creation` datetime NOT NULL,
  PRIMARY KEY (`idddl`),
  KEY `catddl` (`cat`),
  KEY `mbrddlup` (`auteur`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `ddl_coms`
--

CREATE TABLE IF NOT EXISTS `ddl_coms` (
  `idddl_coms` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `ddlid` int(10) unsigned NOT NULL,
  `auteur` int(10) unsigned DEFAULT NULL,
  `contenu` text COLLATE utf8_unicode_ci,
  `creation` datetime NOT NULL,
  PRIMARY KEY (`idddl_coms`),
  KEY `ddlidcom` (`ddlid`),
  KEY `mbrddlcom` (`auteur`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `ddl_hits`
--

CREATE TABLE IF NOT EXISTS `ddl_hits` (
  `mbr` int(10) unsigned NOT NULL,
  `ddl_id` int(10) unsigned NOT NULL,
  `creation` datetime NOT NULL,
  PRIMARY KEY (`mbr`,`ddl_id`),
  KEY `mbrddldown` (`mbr`),
  KEY `ddlidi` (`ddl_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `ddl_votes`
--

CREATE TABLE IF NOT EXISTS `ddl_votes` (
  `idddl` int(10) unsigned NOT NULL,
  `mid` int(10) unsigned NOT NULL,
  `note` tinyint(3) unsigned NOT NULL,
  `creation` datetime NOT NULL,
  PRIMARY KEY (`idddl`,`mid`),
  KEY `mbrddlvote` (`mid`),
  KEY `idddlvote` (`idddl`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `dons`
--

CREATE TABLE IF NOT EXISTS `dons` (
  `iddons` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `mid` int(10) unsigned NOT NULL,
  `creation` datetime NOT NULL,
  `valeur` float unsigned NOT NULL,
  PRIMARY KEY (`iddons`),
  KEY `mbrdon` (`mid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `frm_cat`
--

CREATE TABLE IF NOT EXISTS `frm_cat` (
  `idfrm_cat` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `frm_catnom` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`idfrm_cat`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `frm_forum`
--

CREATE TABLE IF NOT EXISTS `frm_forum` (
  `idfrm_forum` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `catid` int(10) unsigned NOT NULL,
  `frm_titre` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `frm_desc` varchar(140) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`idfrm_forum`),
  KEY `cat` (`catid`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `frm_msg`
--

CREATE TABLE IF NOT EXISTS `frm_msg` (
  `idfrm_msg` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `sujet` int(10) unsigned NOT NULL,
  `auteur` int(10) unsigned DEFAULT NULL,
  `message` mediumtext COLLATE utf8_unicode_ci NOT NULL,
  `creation` datetime NOT NULL,
  `edition` datetime DEFAULT NULL,
  `suppression` datetime DEFAULT NULL,
  PRIMARY KEY (`idfrm_msg`),
  KEY `sjt` (`sujet`),
  KEY `mbr` (`auteur`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `frm_sujet`
--

CREATE TABLE IF NOT EXISTS `frm_sujet` (
  `idfrm_sujet` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `forum` int(10) unsigned NOT NULL,
  `titre` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
  `hits` int(10) unsigned NOT NULL,
  `verrouille` tinyint(1) NOT NULL DEFAULT '0',
  `postit` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`idfrm_sujet`),
  KEY `frmsjt` (`forum`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `frm_sujetopt`
--

CREATE TABLE IF NOT EXISTS `frm_sujetopt` (
  `idsjt` int(10) unsigned NOT NULL,
  `mbrid` int(10) unsigned NOT NULL,
  `favori` tinyint(1) NOT NULL DEFAULT '0',
  `poste` tinyint(1) NOT NULL DEFAULT '0',
  `derniermsglu` int(10) unsigned NOT NULL,
  PRIMARY KEY (`idsjt`,`mbrid`),
  KEY `mbrsjtopt` (`mbrid`),
  KEY `sjtidopt` (`idsjt`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `ip`
--

CREATE TABLE IF NOT EXISTS `ip` (
  `ip` varbinary(16) NOT NULL,
  `mid` int(10) unsigned NOT NULL,
  `creation` datetime NOT NULL,
  `lastconnect` datetime NOT NULL,
  PRIMARY KEY (`ip`),
  KEY `mbrip` (`mid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `mp_msg`
--

CREATE TABLE IF NOT EXISTS `mp_msg` (
  `mpmsg_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `mp_id` int(10) unsigned DEFAULT NULL,
  `mp_auteur` int(10) unsigned DEFAULT NULL,
  `mp_date` datetime DEFAULT NULL,
  `mp_txt` mediumtext COLLATE utf8_unicode_ci,
  PRIMARY KEY (`mpmsg_id`),
  KEY `mpsjtmsg` (`mp_id`),
  KEY `membrempmsg` (`mp_auteur`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `mp_participants`
--

CREATE TABLE IF NOT EXISTS `mp_participants` (
  `mp_id` int(10) unsigned NOT NULL,
  `mp_mid` int(10) unsigned NOT NULL,
  `readed` tinyint(1) DEFAULT NULL,
  `deleted` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`mp_id`,`mp_mid`),
  KEY `mpsjtpart` (`mp_id`),
  KEY `mbrmppart` (`mp_mid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `mp_sujet`
--

CREATE TABLE IF NOT EXISTS `mp_sujet` (
  `mp_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `mp_sujet` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`mp_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `news`
--

CREATE TABLE IF NOT EXISTS `news` (
  `idnews` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `titre` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
  `contenu` text COLLATE utf8_unicode_ci NOT NULL,
  `creation` datetime NOT NULL,
  `auteur` int(10) unsigned NOT NULL,
  PRIMARY KEY (`idnews`),
  KEY `mbrnews` (`auteur`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `requete`
--

CREATE TABLE IF NOT EXISTS `requete` (
  `idrequete` int(11) NOT NULL AUTO_INCREMENT,
  `catid` int(10) unsigned NOT NULL,
  `titre` varchar(140) COLLATE utf8_unicode_ci NOT NULL,
  `description` text COLLATE utf8_unicode_ci NOT NULL,
  `auteur` int(10) unsigned DEFAULT NULL,
  `uploader` int(10) unsigned DEFAULT NULL,
  `creation` datetime DEFAULT NULL,
  `reponse` datetime DEFAULT NULL,
  PRIMARY KEY (`idrequete`),
  KEY `reqcat` (`catid`),
  KEY `reqmbr1` (`uploader`),
  KEY `reqmbr2` (`auteur`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `sdg_questions`
--

CREATE TABLE IF NOT EXISTS `sdg_questions` (
  `idsdg_questions` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `question` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `creation` datetime NOT NULL,
  PRIMARY KEY (`idsdg_questions`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `sdg_reponses`
--

CREATE TABLE IF NOT EXISTS `sdg_reponses` (
  `idsdg_reponses` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `idquest` int(10) unsigned NOT NULL,
  `reponse` varchar(128) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`idsdg_reponses`),
  KEY `idquest` (`idquest`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `sdg_votes`
--

CREATE TABLE IF NOT EXISTS `sdg_votes` (
  `idreponse` int(10) unsigned NOT NULL,
  `mid` int(10) unsigned NOT NULL,
  `creation` datetime NOT NULL,
  PRIMARY KEY (`mid`,`idreponse`),
  KEY `mbrvote` (`mid`),
  KEY `idreponsesdg` (`idreponse`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `shoutbox`
--

CREATE TABLE IF NOT EXISTS `shoutbox` (
  `sht_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `sht_mid` int(10) unsigned DEFAULT NULL,
  `sht_date` datetime DEFAULT NULL,
  `sht_txt` text COLLATE utf8_unicode_ci,
  `sht_system` tinyint(1) DEFAULT '0',
  `sht_priorite` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`sht_id`),
  KEY `membre` (`sht_mid`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `sht_coms`
--

CREATE TABLE IF NOT EXISTS `sht_coms` (
  `idsht_coms` int(11) NOT NULL AUTO_INCREMENT,
  `shtcom_sid` int(10) unsigned DEFAULT NULL,
  `shtcom_mid` int(10) unsigned NOT NULL,
  `shtcom_date` datetime DEFAULT NULL,
  `shtcom_txt` mediumtext COLLATE utf8_unicode_ci,
  PRIMARY KEY (`idsht_coms`),
  KEY `shtcommid` (`shtcom_mid`),
  KEY `shtcomsht` (`shtcom_sid`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `sht_likes`
--

CREATE TABLE IF NOT EXISTS `sht_likes` (
  `sht_id` int(10) unsigned NOT NULL,
  `mbr_id` int(10) unsigned NOT NULL,
  `warn` char(1) COLLATE utf8_unicode_ci DEFAULT '0',
  PRIMARY KEY (`sht_id`,`mbr_id`),
  KEY `shtlikesid` (`sht_id`),
  KEY `shtlikembr` (`mbr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `top_referer`
--

CREATE TABLE IF NOT EXISTS `top_referer` (
  `idtop_referer` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `idsite` int(10) unsigned NOT NULL,
  `ip` int(10) unsigned NOT NULL,
  `creation` datetime NOT NULL,
  PRIMARY KEY (`idtop_referer`),
  KEY `topsitereferer` (`idsite`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `top_sites`
--

CREATE TABLE IF NOT EXISTS `top_sites` (
  `idsite` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `nom` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `url` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `proprio` int(10) unsigned DEFAULT NULL,
  `banniere` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `upload` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`idsite`),
  KEY `mbrtopsites` (`proprio`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `top_votes`
--

CREATE TABLE IF NOT EXISTS `top_votes` (
  `idtop_votes` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `idsite` int(10) unsigned NOT NULL,
  `ip` int(10) unsigned NOT NULL,
  `mid` int(10) unsigned DEFAULT NULL,
  `dateclic` datetime NOT NULL,
  `note` tinyint(3) unsigned DEFAULT NULL,
  PRIMARY KEY (`idtop_votes`),
  KEY `votetopsite` (`idsite`),
  KEY `mid` (`mid`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Contraintes pour les tables exportées
--

--
-- Contraintes pour la table `ddl`
--
ALTER TABLE `ddl`
  ADD CONSTRAINT `mbrddlup` FOREIGN KEY (`auteur`) REFERENCES `membre` (`mbr_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;

--
-- Contraintes pour la table `ddl_coms`
--
ALTER TABLE `ddl_coms`
  ADD CONSTRAINT `ddlidcom` FOREIGN KEY (`ddlid`) REFERENCES `ddl` (`idddl`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `mbrddlcom` FOREIGN KEY (`auteur`) REFERENCES `membre` (`mbr_id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Contraintes pour la table `ddl_hits`
--
ALTER TABLE `ddl_hits`
  ADD CONSTRAINT `ddlidi` FOREIGN KEY (`ddl_id`) REFERENCES `ddl` (`idddl`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `mbrddldown` FOREIGN KEY (`mbr`) REFERENCES `membre` (`mbr_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `ddl_votes`
--
ALTER TABLE `ddl_votes`
  ADD CONSTRAINT `ddl_votes_ibfk_1` FOREIGN KEY (`mid`) REFERENCES `membre` (`mbr_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `ddl_votes_ibfk_2` FOREIGN KEY (`idddl`) REFERENCES `ddl` (`idddl`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `dons`
--
ALTER TABLE `dons`
  ADD CONSTRAINT `mbrdon` FOREIGN KEY (`mid`) REFERENCES `membre` (`mbr_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;

--
-- Contraintes pour la table `frm_forum`
--
ALTER TABLE `frm_forum`
  ADD CONSTRAINT `cat` FOREIGN KEY (`catid`) REFERENCES `frm_cat` (`idfrm_cat`) ON DELETE NO ACTION ON UPDATE CASCADE;

--
-- Contraintes pour la table `frm_msg`
--
ALTER TABLE `frm_msg`
  ADD CONSTRAINT `mbr` FOREIGN KEY (`auteur`) REFERENCES `membre` (`mbr_id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `sjt` FOREIGN KEY (`sujet`) REFERENCES `frm_sujet` (`idfrm_sujet`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `frm_sujet`
--
ALTER TABLE `frm_sujet`
  ADD CONSTRAINT `frmsjt` FOREIGN KEY (`forum`) REFERENCES `frm_forum` (`idfrm_forum`) ON DELETE NO ACTION ON UPDATE CASCADE;

--
-- Contraintes pour la table `frm_sujetopt`
--
ALTER TABLE `frm_sujetopt`
  ADD CONSTRAINT `mbrsjtopt` FOREIGN KEY (`mbrid`) REFERENCES `membre` (`mbr_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `sjtidopt` FOREIGN KEY (`idsjt`) REFERENCES `frm_sujet` (`idfrm_sujet`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `ip`
--
ALTER TABLE `ip`
  ADD CONSTRAINT `mbrip` FOREIGN KEY (`mid`) REFERENCES `membre` (`mbr_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `mp_msg`
--
ALTER TABLE `mp_msg`
  ADD CONSTRAINT `membrempmsg` FOREIGN KEY (`mp_auteur`) REFERENCES `membre` (`mbr_id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `mpsjtmsg` FOREIGN KEY (`mp_id`) REFERENCES `mp_sujet` (`mp_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `mp_participants`
--
ALTER TABLE `mp_participants`
  ADD CONSTRAINT `mbrmppart` FOREIGN KEY (`mp_mid`) REFERENCES `membre` (`mbr_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `mpsjtpart` FOREIGN KEY (`mp_id`) REFERENCES `mp_sujet` (`mp_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `news`
--
ALTER TABLE `news`
  ADD CONSTRAINT `mbrnews` FOREIGN KEY (`auteur`) REFERENCES `membre` (`mbr_id`) ON UPDATE CASCADE;

--
-- Contraintes pour la table `requete`
--
ALTER TABLE `requete`
  ADD CONSTRAINT `reqmbr1` FOREIGN KEY (`uploader`) REFERENCES `membre` (`mbr_id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `reqmbr2` FOREIGN KEY (`auteur`) REFERENCES `membre` (`mbr_id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Contraintes pour la table `sdg_reponses`
--
ALTER TABLE `sdg_reponses`
  ADD CONSTRAINT `idquest` FOREIGN KEY (`idquest`) REFERENCES `sdg_questions` (`idsdg_questions`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `sdg_votes`
--
ALTER TABLE `sdg_votes`
  ADD CONSTRAINT `idreponsesdg` FOREIGN KEY (`idreponse`) REFERENCES `sdg_reponses` (`idsdg_reponses`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `mbrvote` FOREIGN KEY (`mid`) REFERENCES `membre` (`mbr_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `shoutbox`
--
ALTER TABLE `shoutbox`
  ADD CONSTRAINT `membre` FOREIGN KEY (`sht_mid`) REFERENCES `membre` (`mbr_id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Contraintes pour la table `sht_coms`
--
ALTER TABLE `sht_coms`
  ADD CONSTRAINT `shtcommid` FOREIGN KEY (`shtcom_mid`) REFERENCES `membre` (`mbr_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `shtcomsht` FOREIGN KEY (`shtcom_sid`) REFERENCES `shoutbox` (`sht_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `sht_likes`
--
ALTER TABLE `sht_likes`
  ADD CONSTRAINT `shtlikembr` FOREIGN KEY (`mbr_id`) REFERENCES `membre` (`mbr_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `shtlikesid` FOREIGN KEY (`sht_id`) REFERENCES `shoutbox` (`sht_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `top_referer`
--
ALTER TABLE `top_referer`
  ADD CONSTRAINT `topsitereferer` FOREIGN KEY (`idsite`) REFERENCES `top_sites` (`idsite`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `top_sites`
--
ALTER TABLE `top_sites`
  ADD CONSTRAINT `mbrtopsites` FOREIGN KEY (`proprio`) REFERENCES `membre` (`mbr_id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Contraintes pour la table `top_votes`
--
ALTER TABLE `top_votes`
  ADD CONSTRAINT `top_votes_ibfk_1` FOREIGN KEY (`mid`) REFERENCES `membre` (`mbr_id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `votetopsite` FOREIGN KEY (`idsite`) REFERENCES `top_sites` (`idsite`) ON DELETE NO ACTION ON UPDATE NO ACTION;
COMMIT;

START TRANSACTION;
INSERT INTO `cat` (`id`, `titre`, `image`, `root_id`, `lft`, `rgt`, `level`) VALUES
(1, 'Films', 'movies.png', 1, 1, 12, 0),
(2, 'Séries', 'television.png', 2, 1, 2, 0),
(3, 'Musiques', 'music.png', 3, 1, 2, 0),
(4, 'Jeux', 'controller.png', 4, 1, 2, 0),
(5, 'Logiciels', 'application.png', 5, 1, 2, 0),
(6, 'Livres', 'books.png', 6, 1, 2, 0),
(7, 'Animations', 'kids.png', 7, 1, 2, 0),
(8, 'Documentaires', 'video.png', 8, 1, 2, 0),
(9, 'Audiobooks', 'paper_airplane.png', 9, 1, 2, 0),
(11, 'VOST FR', 'film.png', 1, 10, 11, 1),
(12, 'FR et francophones', 'film.png', 1, 8, 9, 1),
(13, 'Étrangers VF', 'film.png', 1, 6, 7, 1),
(14, 'Multilangues', 'world.png', 1, 4, 5, 1),
(15, 'Concerts', 'speakers.png', 15, 1, 2, 0),
(16, 'Théâtre', 'private.png', 16, 1, 2, 0),
(17, 'Sport', 'sport.png', 17, 1, 2, 0),
(18, 'VO', 'film.png', 1, 2, 3, 1);
COMMIT;