-
Notifications
You must be signed in to change notification settings - Fork 1
/
db.sql
243 lines (203 loc) · 6.47 KB
/
db.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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
-- phpMyAdmin SQL Dump
-- version 4.9.5
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Tempo de geração: 25/01/2023 às 08:51
-- Versão do servidor: 8.0.24
-- Versão do PHP: 8.0.26
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 */;
--
-- Banco de dados: `zapimanagement`
--
-- --------------------------------------------------------
--
-- Estrutura para tabela `cake_d_c_users_phinxlog`
--
CREATE TABLE `cake_d_c_users_phinxlog` (
`version` bigint NOT NULL,
`migration_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`start_time` timestamp NULL DEFAULT NULL,
`end_time` timestamp NULL DEFAULT NULL,
`breakpoint` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Despejando dados para a tabela `cake_d_c_users_phinxlog`
--
INSERT INTO `cake_d_c_users_phinxlog` (`version`, `migration_name`, `start_time`, `end_time`, `breakpoint`) VALUES
(20150513201111, 'Initial', '2023-01-17 06:55:32', '2023-01-17 06:55:33', 0),
(20161031101316, 'AddSecretToUsers', '2023-01-17 06:55:33', '2023-01-17 06:55:33', 0),
(20190208174112, 'AddAdditionalDataToUsers', '2023-01-17 06:55:33', '2023-01-17 06:55:33', 0),
(20210929202041, 'AddLastLoginToUsers', '2023-01-17 06:55:33', '2023-01-17 06:55:33', 0);
-- --------------------------------------------------------
--
-- Estrutura para tabela `chatwoots`
--
CREATE TABLE `chatwoots` (
`code_chat_id` int NOT NULL,
`inbox` int NOT NULL,
`user_api` varchar(255) NOT NULL,
`account_id` int NOT NULL,
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
`id` int NOT NULL,
`json` json NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
-- --------------------------------------------------------
--
-- Estrutura para tabela `code_chats`
--
CREATE TABLE `code_chats` (
`id` int NOT NULL,
`numero` varchar(30) NOT NULL,
`user_id` char(36) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`server_id` int NOT NULL,
`api` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`api_key` varchar(255) NOT NULL,
`created` datetime NOT NULL,
`modified` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
-- --------------------------------------------------------
--
-- Estrutura para tabela `servers`
--
CREATE TABLE `servers` (
`id` int NOT NULL,
`nome` varchar(30) NOT NULL,
`url` varchar(255) NOT NULL,
`api_geral` varchar(255) NOT NULL,
`created` datetime NOT NULL,
`modified` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
-- --------------------------------------------------------
--
-- Estrutura para tabela `social_accounts`
--
CREATE TABLE `social_accounts` (
`id` char(36) NOT NULL,
`user_id` char(36) NOT NULL,
`provider` varchar(255) NOT NULL,
`username` varchar(255) DEFAULT NULL,
`reference` varchar(255) NOT NULL,
`avatar` varchar(255) DEFAULT NULL,
`description` text,
`link` varchar(255) NOT NULL,
`token` varchar(500) NOT NULL,
`token_secret` varchar(500) DEFAULT NULL,
`token_expires` datetime DEFAULT NULL,
`active` tinyint(1) NOT NULL DEFAULT '1',
`data` text NOT NULL,
`created` datetime NOT NULL,
`modified` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
-- --------------------------------------------------------
--
-- Estrutura para tabela `users`
--
CREATE TABLE `users` (
`id` char(36) NOT NULL,
`username` varchar(255) NOT NULL,
`email` varchar(255) DEFAULT NULL,
`password` varchar(255) NOT NULL,
`first_name` varchar(50) DEFAULT NULL,
`last_name` varchar(50) DEFAULT NULL,
`token` varchar(255) DEFAULT NULL,
`token_expires` datetime DEFAULT NULL,
`api_token` varchar(255) DEFAULT NULL,
`activation_date` datetime DEFAULT NULL,
`secret` varchar(32) DEFAULT NULL,
`secret_verified` tinyint(1) DEFAULT NULL,
`tos_date` datetime DEFAULT NULL,
`active` tinyint(1) NOT NULL DEFAULT '0',
`is_superuser` tinyint(1) NOT NULL DEFAULT '0',
`role` varchar(255) DEFAULT 'user',
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
`additional_data` text,
`last_login` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
--
-- Índices de tabelas apagadas
--
--
-- Índices de tabela `cake_d_c_users_phinxlog`
--
ALTER TABLE `cake_d_c_users_phinxlog`
ADD PRIMARY KEY (`version`);
--
-- Índices de tabela `chatwoots`
--
ALTER TABLE `chatwoots`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `trava` (`code_chat_id`);
--
-- Índices de tabela `code_chats`
--
ALTER TABLE `code_chats`
ADD PRIMARY KEY (`id`),
ADD KEY `servidorForeing` (`server_id`),
ADD KEY `usuario` (`user_id`);
--
-- Índices de tabela `servers`
--
ALTER TABLE `servers`
ADD PRIMARY KEY (`id`);
--
-- Índices de tabela `social_accounts`
--
ALTER TABLE `social_accounts`
ADD PRIMARY KEY (`id`),
ADD KEY `user_id` (`user_id`);
--
-- Índices de tabela `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT de tabelas apagadas
--
--
-- AUTO_INCREMENT de tabela `chatwoots`
--
ALTER TABLE `chatwoots`
MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT de tabela `code_chats`
--
ALTER TABLE `code_chats`
MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25;
--
-- AUTO_INCREMENT de tabela `servers`
--
ALTER TABLE `servers`
MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- Restrições para dumps de tabelas
--
--
-- Restrições para tabelas `chatwoots`
--
ALTER TABLE `chatwoots`
ADD CONSTRAINT `codeChats` FOREIGN KEY (`code_chat_id`) REFERENCES `code_chats` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
--
-- Restrições para tabelas `code_chats`
--
ALTER TABLE `code_chats`
ADD CONSTRAINT `servidorForeing` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
ADD CONSTRAINT `usuario` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
--
-- Restrições para tabelas `social_accounts`
--
ALTER TABLE `social_accounts`
ADD CONSTRAINT `social_accounts_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
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 */;