1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-12-29 06:58:50 +00:00
comunicapiv3/docs/db_struct.sql

249 lines
8.8 KiB
MySQL
Raw Normal View History

2021-02-13 09:10:31 +00:00
-- Comunic Structure
SET NAMES utf8;
SET time_zone = '+00:00';
DROP TABLE IF EXISTS `aime`;
CREATE TABLE `aime` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ID_type` int(11) NOT NULL,
`ID_personne` int(11) NOT NULL,
`Date_envoi` datetime NOT NULL,
`type` varchar(255) NOT NULL DEFAULT 'texte',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `amis`;
CREATE TABLE `amis` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ID_personne` int(11) NOT NULL,
`ID_amis` int(11) NOT NULL,
`actif` int(11) NOT NULL DEFAULT '0',
`abonnement` int(11) NOT NULL DEFAULT '0',
`autoriser_post_page` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `commentaires`;
CREATE TABLE `commentaires` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ID_personne` int(11) NOT NULL,
`ID_texte` int(11) NOT NULL,
`date_envoi` datetime NOT NULL,
`time_insert` int(11) DEFAULT NULL,
`commentaire` varchar(255) NOT NULL,
`image_commentaire` longtext NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
2021-02-13 13:37:15 +00:00
DROP TABLE IF EXISTS `comunic_clients`;
CREATE TABLE `comunic_clients` (
`id` INT NOT NULL AUTO_INCREMENT,
2021-02-13 11:24:07 +00:00
`name` VARCHAR(45) NOT NULL,
`domain` VARCHAR(45) NULL COMMENT 'Use to check Referer & define Access-Control-Allow-Origin',
`comment` VARCHAR(45) NULL COMMENT 'Information about the client',
2021-02-13 15:01:44 +00:00
`default_expiration_time` INT DEFAULT 2592000 COMMENT '2592000 = 1 month',
2021-02-13 11:24:07 +00:00
PRIMARY KEY (`ID`));
2021-02-13 13:37:15 +00:00
DROP TABLE IF EXISTS `comunic_user_access_tokens`;
CREATE TABLE `comunic_user_access_tokens` (
2021-02-13 09:10:31 +00:00
`id` INT NOT NULL AUTO_INCREMENT,
2021-02-13 11:24:07 +00:00
`client_id` INT NOT NULL,
2021-02-13 13:37:15 +00:00
`user_id` INT NOT NULL,
2021-02-13 11:24:07 +00:00
`token` VARCHAR(255) NOT NULL,
`last_refresh` INT NOT NULL,
`timeout` INT NOT NULL,
PRIMARY KEY (`id`));
2021-02-13 09:10:31 +00:00
DROP TABLE IF EXISTS `comunic_conversations_list`;
CREATE TABLE `comunic_conversations_list` (
2021-03-02 16:01:27 +00:00
`id` int NOT NULL AUTO_INCREMENT,
2021-02-13 09:10:31 +00:00
`name` varchar(50) DEFAULT NULL,
2021-03-02 16:01:27 +00:00
`creation_time` int DEFAULT NULL,
`can_everyone_add_members` tinyint DEFAULT '1',
`color` varchar(6) DEFAULT NULL,
2021-03-05 13:20:50 +00:00
`logo` varchar(255) DEFAULT NULL,
2021-03-02 16:01:27 +00:00
`group_id` int DEFAULT NULL,
2021-03-04 14:11:56 +00:00
`last_activity` int DEFAULT NULL,
2021-02-13 09:10:31 +00:00
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `comunic_conversations_messages`;
CREATE TABLE `comunic_conversations_messages` (
2021-03-02 15:46:41 +00:00
`id` int NOT NULL AUTO_INCREMENT,
`conv_id` int DEFAULT NULL,
`user_id` int DEFAULT NULL,
`time_sent` int DEFAULT NULL,
`message` text,
2021-03-04 16:09:52 +00:00
`file_path` varchar(255) DEFAULT NULL,
2021-03-02 15:46:41 +00:00
`file_size` int DEFAULT NULL,
`file_name` varchar(255) DEFAULT NULL,
`file_thumbnail` varchar(255) DEFAULT NULL,
`file_type` varchar(128) DEFAULT NULL,
2021-02-13 09:10:31 +00:00
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
2021-03-02 15:46:41 +00:00
2021-03-02 15:52:50 +00:00
DROP TABLE IF EXISTS `comunic_conversations_members`;
CREATE TABLE `comunic_conversations_members` (
`id` int NOT NULL AUTO_INCREMENT,
`conv_id` int DEFAULT NULL,
`user_id` int DEFAULT NULL,
`added_on` int DEFAULT NULL,
`following` int DEFAULT '0',
`is_admin` int DEFAULT '1',
`last_message_seen` int DEFAULT '0',
`last_access` int DEFAULT '0',
2021-02-13 09:10:31 +00:00
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
2021-03-02 15:52:50 +00:00
2021-02-13 09:10:31 +00:00
DROP TABLE IF EXISTS `comunic_groups`;
CREATE TABLE `comunic_groups` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`time_create` int(11) DEFAULT NULL,
`userid_create` int(11) DEFAULT NULL,
`name` varchar(45) DEFAULT NULL,
2021-02-14 15:09:43 +00:00
`path_logo` varchar(250) DEFAULT NULL,
2021-02-13 09:10:31 +00:00
`visibility` int(11) NOT NULL DEFAULT '1',
`registration_level` int(11) DEFAULT '1',
`posts_level` int(11) DEFAULT '0',
`virtual_directory` varchar(45) DEFAULT NULL,
`description` varchar(255) DEFAULT NULL,
`url` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `comunic_groups_members`;
CREATE TABLE `comunic_groups_members` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`groups_id` int(11) DEFAULT NULL,
`user_id` varchar(45) DEFAULT NULL,
`time_create` varchar(45) DEFAULT NULL,
`level` int(11) DEFAULT '2',
`following` tinyint(4) DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `comunic_notifications`;
CREATE TABLE `comunic_notifications` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`time_create` int(11) DEFAULT NULL,
`seen` int(1) DEFAULT '0',
`from_user_id` int(11) DEFAULT NULL,
`dest_user_id` int(11) DEFAULT NULL,
`on_elem_id` int(11) DEFAULT NULL,
`on_elem_type` varchar(25) DEFAULT NULL,
`type` varchar(50) DEFAULT NULL,
`visibility` varchar(20) DEFAULT NULL,
`from_container_id` int(11) DEFAULT NULL,
`from_container_type` varchar(25) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `sondage`;
CREATE TABLE `sondage` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ID_utilisateurs` int(11) NOT NULL,
`ID_texte` int(11) NOT NULL,
`date_creation` datetime NOT NULL,
`question` varchar(255) NOT NULL,
`allow_new_choices` int(11) DEFAULT '0',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `sondage_choix`;
CREATE TABLE `sondage_choix` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ID_sondage` int(11) NOT NULL,
`date_creation` datetime NOT NULL,
`Choix` varchar(255) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `sondage_reponse`;
CREATE TABLE `sondage_reponse` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ID_utilisateurs` int(11) NOT NULL,
`ID_sondage` int(11) NOT NULL,
`ID_sondage_choix` int(11) NOT NULL,
`date_envoi` datetime NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `texte`;
CREATE TABLE `texte` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ID_personne` int(11) NOT NULL,
`date_envoi` datetime NOT NULL,
`time_insert` int(11) DEFAULT NULL,
`texte` text NOT NULL,
`ID_amis` int(11) NOT NULL DEFAULT '0',
`group_id` int(11) DEFAULT '0',
`niveau_visibilite` varchar(255) NOT NULL DEFAULT '1',
`type` varchar(255) NOT NULL DEFAULT 'texte',
`size` varchar(255) DEFAULT NULL,
`file_type` varchar(255) DEFAULT NULL,
`path` varchar(255) DEFAULT NULL,
`annee_fin` varchar(255) DEFAULT NULL,
`mois_fin` varchar(255) DEFAULT NULL,
`jour_fin` varchar(255) DEFAULT NULL,
`time_end` int(11) DEFAULT NULL,
`url_page` varchar(255) DEFAULT NULL,
`titre_page` varchar(255) DEFAULT NULL,
`description_page` longtext,
`image_page` varchar(255) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `utilisateurs`;
CREATE TABLE `utilisateurs` (
2021-02-14 15:18:13 +00:00
`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,
2021-02-13 09:10:31 +00:00
`date_creation` datetime NOT NULL,
2021-02-14 15:18:13 +00:00
`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',
2021-02-13 09:10:31 +00:00
`account_image_path` varchar(255) NOT NULL DEFAULT '',
`account_image_visibility` varchar(45) NOT NULL DEFAULT 'everyone',
2021-02-14 15:18:13 +00:00
`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',
2021-02-13 09:10:31 +00:00
PRIMARY KEY (`ID`)
2021-02-14 15:18:13 +00:00
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
2021-02-13 09:10:31 +00:00
DROP TABLE IF EXISTS `comunic_custom_emojis`;
CREATE TABLE `comunic_custom_emojis` (
`id` INT NOT NULL AUTO_INCREMENT,
`user_id` INT NULL,
`shortcut` VARCHAR(45) NULL,
`path` VARCHAR(255) NULL,
2021-03-04 14:11:56 +00:00
PRIMARY KEY (`id`));