-
Notifications
You must be signed in to change notification settings - Fork 0
/
tifod.sql
191 lines (156 loc) · 4.63 KB
/
tifod.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
-- phpMyAdmin SQL Dump
-- version 4.9.2
-- https://www.phpmyadmin.net/
--
-- Hôte : localhost
-- Généré le : mar. 10 déc. 2019 à 13:35
-- Version du serveur : 10.4.10-MariaDB
-- Version de PHP : 7.4.0
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
CREATE DATABASE IF NOT EXISTS beta_tifod DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
USE beta_tifod;
DROP TABLE IF EXISTS platform_data;
CREATE TABLE `platform_data` (
`data_name` varchar(100) NOT NULL,
`data_value` text NOT NULL,
PRIMARY KEY (`data_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
INSERT INTO `platform_data` (`data_name`, `data_value`) VALUES ('version', '1.0.0');
DROP TABLE IF EXISTS post;
CREATE TABLE IF NOT EXISTS post (
id int(11) NOT NULL AUTO_INCREMENT,
content text CHARACTER SET utf8mb4 DEFAULT NULL,
content_type varchar(50) NOT NULL,
parent_id int(11) NOT NULL,
project_id int(11) NOT NULL,
path text DEFAULT NULL,
vote_plus int(11) NOT NULL DEFAULT 0,
vote_minus int(11) NOT NULL DEFAULT 0,
score_result int(11) NOT NULL DEFAULT 0,
score_percent int(11) NOT NULL DEFAULT 0,
user_id_pin int(11) NOT NULL DEFAULT 0,
edit_id int(11) NOT NULL DEFAULT 0,
is_an_edit tinyint(1) NOT NULL DEFAULT 0,
auto_pin_edits tinyint(1) NOT NULL DEFAULT 0,
posted_on timestamp NOT NULL DEFAULT current_timestamp(),
author_id int(11) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Structure de la table `post_vote`
--
CREATE TABLE `post_vote` (
`post_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`is_upvote` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Structure de la table `project`
--
CREATE TABLE `project` (
`project_id` int(11) NOT NULL,
`project_type` varchar(100) NOT NULL,
`project_root_post_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Structure de la table `project_role`
--
CREATE TABLE `project_role` (
`user_id` int(11) NOT NULL,
`project_id` int(11) NOT NULL,
`project_role` varchar(100) NOT NULL DEFAULT 'none'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Structure de la table `token`
--
CREATE TABLE `token` (
`token_id` int(11) NOT NULL,
`action` varchar(100) NOT NULL,
`token_key` varchar(100) NOT NULL,
`expiration_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`email` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Structure de la table `user`
--
CREATE TABLE `user` (
`user_id` int(11) NOT NULL,
`user_name` varchar(100) DEFAULT NULL,
`description` text DEFAULT NULL,
`user_password` varchar(100) DEFAULT NULL,
`avatar` varchar(100) NOT NULL DEFAULT 'default.png',
`email` varchar(255) NOT NULL,
`platform_role` varchar(100) NOT NULL DEFAULT 'regular_member'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Index pour les tables déchargées
--
--
-- Index pour la table `platform_data`
--
ALTER TABLE `platform_data`
ADD PRIMARY KEY (`data_name`);
--
-- Index pour la table `post`
--
ALTER TABLE `post`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `post_vote`
--
ALTER TABLE `post_vote`
ADD PRIMARY KEY (`post_id`,`user_id`);
--
-- Index pour la table `project`
--
ALTER TABLE `project`
ADD PRIMARY KEY (`project_id`);
--
-- Index pour la table `project_role`
--
ALTER TABLE `project_role`
ADD PRIMARY KEY (`user_id`,`project_id`);
--
-- Index pour la table `token`
--
ALTER TABLE `token`
ADD PRIMARY KEY (`token_id`);
--
-- Index pour la table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`user_id`);
--
-- AUTO_INCREMENT pour les tables déchargées
--
--
-- AUTO_INCREMENT pour la table `post`
--
ALTER TABLE `post`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `token`
--
ALTER TABLE `token`
MODIFY `token_id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `user`
--
ALTER TABLE `user`
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;