1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-22 21:39:21 +00:00

Start database sanitization

This commit is contained in:
Pierre HUBERT 2021-02-13 10:26:47 +01:00
parent 2af8df317f
commit c883924457
2 changed files with 44 additions and 291 deletions

View File

@ -4,17 +4,6 @@ SET NAMES utf8;
SET time_zone = '+00:00'; SET time_zone = '+00:00';
DROP TABLE IF EXISTS `aide`;
CREATE TABLE `aide` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`titre` varchar(255) NOT NULL,
`affiche_acceuil` int(11) NOT NULL DEFAULT '0',
`aide` longtext NOT NULL,
`lang` varchar(255) NOT NULL DEFAULT 'fr',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `aime`; DROP TABLE IF EXISTS `aime`;
CREATE TABLE `aime` ( CREATE TABLE `aime` (
`ID` int(11) NOT NULL AUTO_INCREMENT, `ID` int(11) NOT NULL AUTO_INCREMENT,
@ -38,28 +27,6 @@ CREATE TABLE `amis` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `chat`;
CREATE TABLE `chat` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ID_personne` int(11) NOT NULL,
`date_envoi` datetime NOT NULL,
`message` text NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `chatprive`;
CREATE TABLE `chatprive` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`date_envoi` datetime NOT NULL,
`ID_personne` int(11) NOT NULL,
`ID_destination` int(11) NOT NULL,
`contenu` varchar(255) NOT NULL,
`vu` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `commentaires`; DROP TABLE IF EXISTS `commentaires`;
CREATE TABLE `commentaires` ( CREATE TABLE `commentaires` (
`ID` int(11) NOT NULL AUTO_INCREMENT, `ID` int(11) NOT NULL AUTO_INCREMENT,
@ -186,19 +153,6 @@ CREATE TABLE `comunic_groups_members` (
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=latin1; ) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `comunic_mails_queue`;
CREATE TABLE `comunic_mails_queue` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`priority` int(11) DEFAULT NULL,
`time_insert` int(11) DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
`template` varchar(45) DEFAULT NULL,
`data` text DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `comunic_notifications`; DROP TABLE IF EXISTS `comunic_notifications`;
CREATE TABLE `comunic_notifications` ( CREATE TABLE `comunic_notifications` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
@ -216,42 +170,6 @@ CREATE TABLE `comunic_notifications` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `contact`;
CREATE TABLE `contact` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ID_personne` int(255) NOT NULL,
`date_envoi` datetime NOT NULL,
`ID_type` int(11) NOT NULL DEFAULT '1',
`texte` text NOT NULL,
`vu` int(11) NOT NULL DEFAULT '0',
`mail_personne` varchar(255) NOT NULL,
`IP_personne` varchar(255) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `forum_reponse`;
CREATE TABLE `forum_reponse` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ID_personne` int(11) NOT NULL,
`ID_sujet` int(11) NOT NULL,
`date_envoi` datetime NOT NULL,
`reponse` longtext NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `forum_sujet`;
CREATE TABLE `forum_sujet` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`titre` varchar(255) NOT NULL,
`ID_personne` int(11) NOT NULL,
`date_envoi` datetime NOT NULL,
`sujet` longtext NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `galerie_video`; DROP TABLE IF EXISTS `galerie_video`;
CREATE TABLE `galerie_video` ( CREATE TABLE `galerie_video` (
`ID` int(11) NOT NULL AUTO_INCREMENT, `ID` int(11) NOT NULL AUTO_INCREMENT,
@ -264,186 +182,6 @@ CREATE TABLE `galerie_video` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `groupe_personnes`;
CREATE TABLE `groupe_personnes` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ID_personne` int(11) NOT NULL,
`liste_ID` longtext NOT NULL,
`date_ajout` datetime NOT NULL,
`nom` varchar(255) NOT NULL DEFAULT 'Groupe sans nom',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `log_admin`;
CREATE TABLE `log_admin` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`type_admin` varchar(255) NOT NULL,
`date_envoi` datetime NOT NULL,
`adresse` varchar(255) NOT NULL,
`nom_admin` varchar(255) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `messagerie`;
CREATE TABLE `messagerie` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ID_expediteur` int(11) NOT NULL,
`ID_destinataire` int(11) NOT NULL,
`objet` varchar(255) NOT NULL,
`message` text NOT NULL,
`date_envoi` datetime NOT NULL,
`lu` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `minifyURL`;
CREATE TABLE `minifyURL` (
`ID` varchar(255) NOT NULL,
`url` varchar(255) NOT NULL,
`date_ajout` datetime NOT NULL,
`auto_redirect` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `multi_login`;
CREATE TABLE `multi_login` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ID_personne` int(11) NOT NULL,
`ID_target` int(11) NOT NULL,
`allowed` int(11) NOT NULL DEFAULT '1',
`date_ajout` datetime NOT NULL,
`IP_ajout` varchar(255) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `notification`;
CREATE TABLE `notification` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ID_personne` int(11) NOT NULL,
`date_envoi` datetime NOT NULL,
`message` varchar(255) NOT NULL,
`ID_createur` int(11) NOT NULL,
`vu` int(11) NOT NULL DEFAULT '0',
`adresse` varchar(255) DEFAULT NULL,
`type` varchar(255) DEFAULT NULL,
`id_type` varchar(255) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `pages`;
CREATE TABLE `pages` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ID_personne` int(11) NOT NULL,
`nom_page` varchar(255) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `scout_abonnement`;
CREATE TABLE `scout_abonnement` (
`ID` tinyint(4) NOT NULL AUTO_INCREMENT,
`ID_personne` int(11) NOT NULL,
`ID_groupe` varchar(255) NOT NULL,
`ID_patrouille` varchar(255) NOT NULL,
`niveau_abonnement` int(11) NOT NULL,
`date_ajout` datetime NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `scout_commentaires`;
CREATE TABLE `scout_commentaires` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ID_personne` int(11) NOT NULL,
`ID_groupe` varchar(255) NOT NULL,
`ID_evenement` varchar(255) NOT NULL,
`date_ajout` datetime NOT NULL,
`commentaire` text NOT NULL,
`url_pdf` varchar(255) NOT NULL,
`url_img` varchar(255) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `scout_droit_groupe`;
CREATE TABLE `scout_droit_groupe` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ID_personne` int(11) NOT NULL,
`ID_groupe` varchar(255) NOT NULL,
`niveau_droit` int(11) NOT NULL DEFAULT '2',
`date_creation` datetime NOT NULL,
`valide` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `scout_evenements`;
CREATE TABLE `scout_evenements` (
`ID` varchar(255) NOT NULL,
`ID_groupe` varchar(255) NOT NULL,
`ID_createur` int(11) NOT NULL,
`date_ajout` datetime NOT NULL,
`nom` varchar(255) NOT NULL,
`transport` varchar(255) NOT NULL,
`choix_categorie` varchar(255) NOT NULL,
`lieu_depart` varchar(255) NOT NULL,
`lieu_evenement` varchar(255) NOT NULL,
`date_depart` varchar(255) NOT NULL,
`date_fin` varchar(255) NOT NULL,
`heure_depart` int(11) NOT NULL,
`minute_depart` int(11) NOT NULL,
`heure_fin` int(11) NOT NULL,
`minute_fin` int(11) NOT NULL,
`details` longtext NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `scout_groupes`;
CREATE TABLE `scout_groupes` (
`ID` varchar(255) NOT NULL,
`nom` varchar(255) NOT NULL,
`ville` varchar(255) NOT NULL,
`code_postal` int(11) NOT NULL,
`ID_createur` int(11) NOT NULL,
`date_creation` int(11) NOT NULL,
`description` longtext NOT NULL,
`groupe_verifie` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`),
UNIQUE KEY `ID` (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `scout_patrouilles`;
CREATE TABLE `scout_patrouilles` (
`ID` varchar(255) NOT NULL,
`ID_createur` int(11) NOT NULL,
`ID_groupe` varchar(255) NOT NULL,
`nom` varchar(255) NOT NULL,
`ID_type_patrouille` int(11) NOT NULL,
`description` longtext NOT NULL,
`date_creation` datetime NOT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `ID` (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `scout_type_patrouille`;
CREATE TABLE `scout_type_patrouille` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`determinant` varchar(255) NOT NULL,
`nom_type` varchar(255) NOT NULL,
`nom_personnes` varchar(255) NOT NULL,
`sexe` varchar(255) NOT NULL DEFAULT 'h',
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `sondage`; DROP TABLE IF EXISTS `sondage`;
CREATE TABLE `sondage` ( CREATE TABLE `sondage` (
`ID` int(11) NOT NULL AUTO_INCREMENT, `ID` int(11) NOT NULL AUTO_INCREMENT,
@ -476,16 +214,6 @@ CREATE TABLE `sondage_reponse` (
PRIMARY KEY (`ID`) PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `sujet_contact`;
CREATE TABLE `sujet_contact` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`nom_fr` varchar(255) NOT NULL,
`nom_en` varchar(255) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `texte`; DROP TABLE IF EXISTS `texte`;
CREATE TABLE `texte` ( CREATE TABLE `texte` (
`ID` int(11) NOT NULL AUTO_INCREMENT, `ID` int(11) NOT NULL AUTO_INCREMENT,
@ -521,7 +249,6 @@ CREATE TABLE `utilisateurs` (
`date_creation` datetime NOT NULL, `date_creation` datetime NOT NULL,
`mail` varchar(255) NOT NULL, `mail` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL, `password` varchar(255) NOT NULL,
`affiche_chat` int(11) NOT NULL DEFAULT '0',
`public` int(11) NOT NULL DEFAULT '0', `public` int(11) NOT NULL DEFAULT '0',
`pageouverte` int(11) NOT NULL DEFAULT '0', `pageouverte` int(11) NOT NULL DEFAULT '0',
`question1` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL, `question1` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL,
@ -530,30 +257,12 @@ CREATE TABLE `utilisateurs` (
`reponse2` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL, `reponse2` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL,
`bloquecommentaire` int(11) NOT NULL DEFAULT '0', `bloquecommentaire` int(11) NOT NULL DEFAULT '0',
`last_activity` int(11) NOT NULL DEFAULT '1', `last_activity` int(11) NOT NULL DEFAULT '1',
`bloquenotification` int(11) NOT NULL DEFAULT '1',
`bloque_son_notification` int(11) NOT NULL DEFAULT '1',
`old_menu` int(11) NOT NULL DEFAULT '0',
`volet_amis_ouvert` int(11) NOT NULL DEFAULT '1',
`autoriser_post_amis` int(11) NOT NULL DEFAULT '1', `autoriser_post_amis` int(11) NOT NULL DEFAULT '1',
`color_menu` varchar(255) NOT NULL DEFAULT 'blue',
`autorise_mail` int(11) NOT NULL DEFAULT '1', `autorise_mail` int(11) NOT NULL DEFAULT '1',
`mode_pages` int(11) NOT NULL DEFAULT '0',
`sous_repertoire` varchar(255) DEFAULT NULL, `sous_repertoire` varchar(255) DEFAULT NULL,
`acces_ecolev2` varchar(1) NOT NULL DEFAULT '0',
`view_private_chat` int(1) NOT NULL DEFAULT '1',
`height_private_chat` int(11) NOT NULL DEFAULT '210',
`nettoyage_automatique_notifications` int(11) NOT NULL DEFAULT '1',
`heure_nettoyage_automatique_notifications` int(11) NOT NULL DEFAULT '0',
`jour_nettoyage_automatique_notifications` int(11) NOT NULL DEFAULT '0',
`mois_nettoyage_automatique_notifications` int(11) NOT NULL DEFAULT '2',
`page_verifiee` int(11) NOT NULL DEFAULT '0', `page_verifiee` int(11) NOT NULL DEFAULT '0',
`site_web` varchar(255) NOT NULL DEFAULT '', `site_web` varchar(255) NOT NULL DEFAULT '',
`liste_amis_publique` varchar(1) NOT NULL DEFAULT '1', `liste_amis_publique` varchar(1) NOT NULL DEFAULT '1',
`new_password` varchar(255) DEFAULT NULL,
`flux_rss` varchar(255) DEFAULT NULL,
`vu_message_info_fil` varchar(255) NOT NULL DEFAULT '0',
`allow_multilogin` int(11) NOT NULL DEFAULT '0',
`allow_piwik` int(11) NOT NULL DEFAULT '1',
`public_note` varchar(255) DEFAULT NULL, `public_note` varchar(255) DEFAULT NULL,
`password_reset_token` varchar(255) DEFAULT NULL, `password_reset_token` varchar(255) DEFAULT NULL,
`password_reset_token_time_create` int(11) DEFAULT NULL, `password_reset_token_time_create` int(11) DEFAULT NULL,

44
docs/migration.sql Normal file
View File

@ -0,0 +1,44 @@
-- Remove deprecated tables
DROP TABLE IF EXISTS `scout_abonnement`;
DROP TABLE IF EXISTS `scout_commentaires`;
DROP TABLE IF EXISTS `scout_droit_groupe`;
DROP TABLE IF EXISTS `scout_evenements`;
DROP TABLE IF EXISTS `scout_patrouilles`;
DROP TABLE IF EXISTS `scout_type_patrouille`;
DROP TABLE IF EXISTS `scout_groupes`;
DROP TABLE IF EXISTS `pages`;
DROP TABLE IF EXISTS `aide`;
DROP TABLE IF EXISTS `chat`;
DROP TABLE IF EXISTS `chatprive`;
DROP TABLE IF EXISTS `comunic_mails_queue`;
DROP TABLE IF EXISTS `contact`;
DROP TABLE IF EXISTS `forum_reponse`;
DROP TABLE IF EXISTS `forum_sujet`;
DROP TABLE IF EXISTS `groupe_personnes`;
DROP TABLE IF EXISTS `log_admin`;
DROP TABLE IF EXISTS `messagerie`;
DROP TABLE IF EXISTS `minifyURL`;
DROP TABLE IF EXISTS `multi_login`;
DROP TABLE IF EXISTS `notification`;
DROP TABLE IF EXISTS `sujet_contact`;
-- Sanitize user table
ALTER TABLE utilisateurs DROP COLUMN allow_piwik;
ALTER TABLE utilisateurs DROP COLUMN allow_multilogin;
ALTER TABLE utilisateurs DROP COLUMN view_private_chat;
ALTER TABLE utilisateurs DROP COLUMN acces_ecolev2;
ALTER TABLE utilisateurs DROP COLUMN color_menu;
ALTER TABLE utilisateurs DROP COLUMN volet_amis_ouvert;
ALTER TABLE utilisateurs DROP COLUMN bloque_son_notification;
ALTER TABLE utilisateurs DROP COLUMN bloquenotification;
ALTER TABLE utilisateurs DROP COLUMN old_menu;
ALTER TABLE utilisateurs DROP COLUMN mode_pages;
ALTER TABLE utilisateurs DROP COLUMN height_private_chat;
ALTER TABLE utilisateurs DROP COLUMN nettoyage_automatique_notifications;
ALTER TABLE utilisateurs DROP COLUMN heure_nettoyage_automatique_notifications;
ALTER TABLE utilisateurs DROP COLUMN jour_nettoyage_automatique_notifications;
ALTER TABLE utilisateurs DROP COLUMN mois_nettoyage_automatique_notifications;
ALTER TABLE utilisateurs DROP COLUMN new_password;
ALTER TABLE utilisateurs DROP COLUMN flux_rss;
ALTER TABLE utilisateurs DROP COLUMN vu_message_info_fil;
ALTER TABLE utilisateurs DROP COLUMN affiche_chat;