From dcceee5048bf27c2778e63b9e6d9c765fdd20a52 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sun, 14 Feb 2021 16:18:13 +0100 Subject: [PATCH] Update database structure --- docs/db_struct.sql | 54 +++++++++++++++++++++++++--------------------- docs/migration.sql | 9 +++++++- 2 files changed, 37 insertions(+), 26 deletions(-) diff --git a/docs/db_struct.sql b/docs/db_struct.sql index 6c2525e..f34675d 100644 --- a/docs/db_struct.sql +++ b/docs/db_struct.sql @@ -195,37 +195,41 @@ CREATE TABLE `texte` ( PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; - DROP TABLE IF EXISTS `utilisateurs`; CREATE TABLE `utilisateurs` ( - `ID` int(11) NOT NULL AUTO_INCREMENT, - `nom` varchar(255) NOT NULL, - `prenom` varchar(255) NOT NULL, + `ID` int NOT NULL AUTO_INCREMENT, + `nom` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, + `prenom` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, `date_creation` datetime NOT NULL, - `mail` varchar(255) NOT NULL, - `password` varchar(255) NOT NULL, - `public` int(11) NOT NULL DEFAULT '0', - `pageouverte` int(11) NOT NULL DEFAULT '0', - `question1` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL, - `reponse1` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL, - `question2` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL, - `reponse2` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL, - `bloquecommentaire` int(11) NOT NULL DEFAULT '0', - `last_activity` int(11) NOT NULL DEFAULT '1', - `autoriser_post_amis` int(11) NOT NULL DEFAULT '1', - `autorise_mail` int(11) NOT NULL DEFAULT '1', - `sous_repertoire` varchar(255) DEFAULT NULL, - `site_web` varchar(255) NOT NULL DEFAULT '', - `liste_amis_publique` varchar(1) NOT NULL DEFAULT '1', - `public_note` varchar(255) DEFAULT NULL, - `password_reset_token` varchar(255) DEFAULT NULL, - `password_reset_token_time_create` int(11) DEFAULT NULL, - `lang` varchar(4) DEFAULT 'en', + `mail` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, + `password` varchar(255) CHARACTER SET latin1 COLLATE utf8mb4_0900_ai_ci NOT NULL, + `public` int NOT NULL DEFAULT '0', + `pageouverte` int NOT NULL DEFAULT '0', + `question1` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `reponse1` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `question2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `reponse2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `bloquecommentaire` int NOT NULL DEFAULT '0', + `last_activity` int NOT NULL DEFAULT '1', + `autoriser_post_amis` int NOT NULL DEFAULT '1', + `autorise_mail` int NOT NULL DEFAULT '1', + `sous_repertoire` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `site_web` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '', + `liste_amis_publique` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '1', + `public_note` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `password_reset_token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `password_reset_token_time_create` int DEFAULT NULL, + `lang` varchar(4) CHARACTER SET latin1 COLLATE utf8mb4_0900_ai_ci DEFAULT 'en', `account_image_path` varchar(255) NOT NULL DEFAULT '', `account_image_visibility` varchar(45) NOT NULL DEFAULT 'everyone', + `delete_account_after` int DEFAULT '0', + `delete_notifications_after` int DEFAULT '7776000', + `delete_comments_after` int DEFAULT '0', + `delete_posts_after` int DEFAULT '0', + `delete_conversation_messages_after` int DEFAULT '0', + `delete_likes_after` int DEFAULT '0', PRIMARY KEY (`ID`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4; DROP TABLE IF EXISTS `comunic_custom_emojis`; CREATE TABLE `comunic_custom_emojis` ( diff --git a/docs/migration.sql b/docs/migration.sql index 105f2e9..3d158dd 100644 --- a/docs/migration.sql +++ b/docs/migration.sql @@ -1 +1,8 @@ --- Nothing yet \ No newline at end of file +-- Update users table +ALTER TABLE `utilisateurs` +ADD COLUMN `delete_account_after` INT NULL DEFAULT 0 AFTER `account_image_visibility`, +ADD COLUMN `delete_notifications_after` INT NULL DEFAULT 7776000 AFTER `delete_account_after`, +ADD COLUMN `delete_comments_after` INT NULL DEFAULT 0 AFTER `delete_notifications_after`, +ADD COLUMN `delete_posts_after` INT NULL DEFAULT 0 AFTER `delete_comments_after`, +ADD COLUMN `delete_conversation_messages_after` INT NULL DEFAULT 0 AFTER `delete_posts_after`, +ADD COLUMN `delete_likes_after` INT NULL DEFAULT 0 AFTER `delete_conversation_messages_after`;