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

237 lines
7.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',
`default_expiration_time` INT GENERATED ALWAYS AS (2592000) COMMENT '2592000 = 1 month',
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` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL,
`name` varchar(50) DEFAULT NULL,
`last_active` int(11) DEFAULT NULL,
`creation_time` int(11) DEFAULT NULL,
`can_everyone_add_members` tinyint(4) DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `comunic_conversations_messages`;
CREATE TABLE `comunic_conversations_messages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`conv_id` int(11) DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
`time_insert` int(11) DEFAULT NULL,
`message` varchar(200) DEFAULT NULL,
`image_path` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `comunic_conversations_users`;
CREATE TABLE `comunic_conversations_users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`conv_id` int(11) DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
`time_add` int(11) DEFAULT NULL,
`following` int(1) DEFAULT '0',
`saw_last_message` int(1) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
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,
`path_logo` varchar(50) DEFAULT NULL,
`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` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`nom` varchar(255) NOT NULL,
`prenom` varchar(255) 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',
`account_image_path` varchar(255) NOT NULL DEFAULT '',
`account_image_visibility` varchar(45) NOT NULL DEFAULT 'everyone',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
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,
PRIMARY KEY (`id`));