· 8 years ago · Aug 19, 2018, 03:22 AM
1Create database if not exists phalcon;
2
3use phalcon;
4
5CREATE TABLE `email_confirmations` (
6 `id` int(10) UNSIGNED NOT NULL,
7 `usersId` int(10) UNSIGNED NOT NULL,
8 `code` char(32) NOT NULL,
9 `createdAt` int(10) UNSIGNED NOT NULL,
10 `modifiedAt` int(10) UNSIGNED DEFAULT NULL,
11 `confirmed` char(1) DEFAULT 'N'
12) ENGINE=InnoDB DEFAULT CHARSET=utf8;
13
14-- --------------------------------------------------------
15
16--
17-- Estructura de tabla para la tabla `failed_logins`
18--
19
20CREATE TABLE `failed_logins` (
21 `id` int(10) UNSIGNED NOT NULL,
22 `usersId` int(10) UNSIGNED DEFAULT NULL,
23 `ipAddress` char(15) NOT NULL,
24 `attempted` int(10) UNSIGNED NOT NULL
25) ENGINE=InnoDB DEFAULT CHARSET=utf8;
26
27-- --------------------------------------------------------
28
29--
30-- Estructura de tabla para la tabla `password_changes`
31--
32
33CREATE TABLE `password_changes` (
34 `id` int(10) UNSIGNED NOT NULL,
35 `usersId` int(10) UNSIGNED NOT NULL,
36 `ipAddress` char(15) NOT NULL,
37 `userAgent` text NOT NULL,
38 `createdAt` int(10) UNSIGNED NOT NULL
39) ENGINE=InnoDB DEFAULT CHARSET=utf8;
40
41--
42-- Volcado de datos para la tabla `password_changes`
43--
44
45INSERT INTO `password_changes` (`id`, `usersId`, `ipAddress`, `userAgent`, `createdAt`) VALUES
46(1, 4, '::1', 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36', 1534635339),
47(2, 4, '::1', 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36', 1534638621),
48(3, 4, '::1', 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36', 1534638655);
49
50-- --------------------------------------------------------
51
52--
53-- Estructura de tabla para la tabla `permissions`
54--
55
56CREATE TABLE `permissions` (
57 `id` int(10) UNSIGNED NOT NULL,
58 `profilesId` int(10) UNSIGNED NOT NULL,
59 `resource` varchar(16) NOT NULL,
60 `action` varchar(16) NOT NULL
61) ENGINE=InnoDB DEFAULT CHARSET=utf8;
62
63--
64-- Volcado de datos para la tabla `permissions`
65--
66
67INSERT INTO `permissions` (`id`, `profilesId`, `resource`, `action`) VALUES
68(1, 3, 'users', 'index'),
69(2, 3, 'users', 'search'),
70(3, 3, 'profiles', 'index'),
71(4, 3, 'profiles', 'search'),
72(5, 1, 'users', 'index'),
73(6, 1, 'users', 'search'),
74(7, 1, 'users', 'edit'),
75(8, 1, 'users', 'create'),
76(9, 1, 'users', 'delete'),
77(10, 1, 'users', 'changePassword'),
78(11, 1, 'profiles', 'index'),
79(12, 1, 'profiles', 'search'),
80(13, 1, 'profiles', 'edit'),
81(14, 1, 'profiles', 'create'),
82(15, 1, 'profiles', 'delete'),
83(16, 1, 'permissions', 'index'),
84(17, 2, 'users', 'index'),
85(18, 2, 'users', 'search'),
86(19, 2, 'users', 'edit'),
87(20, 2, 'users', 'create'),
88(21, 2, 'profiles', 'index'),
89(22, 2, 'profiles', 'search');
90
91-- --------------------------------------------------------
92
93--
94-- Estructura de tabla para la tabla `profiles`
95--
96
97CREATE TABLE `profiles` (
98 `id` int(10) UNSIGNED NOT NULL,
99 `name` varchar(64) NOT NULL,
100 `active` char(1) NOT NULL
101) ENGINE=InnoDB DEFAULT CHARSET=utf8;
102
103--
104-- Volcado de datos para la tabla `profiles`
105--
106
107INSERT INTO `profiles` (`id`, `name`, `active`) VALUES
108(1, 'Administrador', 'Y'),
109(2, 'Usuario', 'Y'),
110(3, 'Lectura', 'Y');
111
112-- --------------------------------------------------------
113
114--
115-- Estructura de tabla para la tabla `remember_tokens`
116--
117
118CREATE TABLE `remember_tokens` (
119 `id` int(10) UNSIGNED NOT NULL,
120 `usersId` int(10) UNSIGNED NOT NULL,
121 `token` char(32) NOT NULL,
122 `userAgent` varchar(120) NOT NULL,
123 `createdAt` int(10) UNSIGNED NOT NULL
124) ENGINE=InnoDB DEFAULT CHARSET=utf8;
125
126-- --------------------------------------------------------
127
128--
129-- Estructura de tabla para la tabla `reset_passwords`
130--
131
132CREATE TABLE `reset_passwords` (
133 `id` int(10) UNSIGNED NOT NULL,
134 `usersId` int(10) UNSIGNED NOT NULL,
135 `code` varchar(48) NOT NULL,
136 `createdAt` int(10) UNSIGNED NOT NULL,
137 `modifiedAt` int(10) UNSIGNED DEFAULT NULL,
138 `reset` char(1) NOT NULL
139) ENGINE=InnoDB DEFAULT CHARSET=utf8;
140
141--
142-- Volcado de datos para la tabla `reset_passwords`
143--
144
145INSERT INTO `reset_passwords` (`id`, `usersId`, `code`, `createdAt`, `modifiedAt`, `reset`) VALUES
146(1, 4, '3NwxRB8z27is9oLGnBU6qsj0dmS21R', 1534635301, 1534635328, 'Y'),
147(2, 3, 'ltT91eF2wOgXC8J626O9V332JZcsE34', 1534636352, 1534636373, 'Y'),
148(3, 4, '4alzL528Djn19H51TqLhHnD7e8huBrj', 1534638517, NULL, 'N'),
149(4, 4, 'I0tbxjTCdFfiAt4VMpSmNpKzDFK0bvhq', 1534638590, 1534638609, 'Y');
150
151-- --------------------------------------------------------
152
153--
154-- Estructura de tabla para la tabla `success_logins`
155--
156
157CREATE TABLE `success_logins` (
158 `id` int(10) UNSIGNED NOT NULL,
159 `usersId` int(10) UNSIGNED NOT NULL,
160 `ipAddress` char(15) NOT NULL,
161 `userAgent` varchar(120) NOT NULL
162) ENGINE=InnoDB DEFAULT CHARSET=utf8;
163
164--
165-- Volcado de datos para la tabla `success_logins`
166--
167
168INSERT INTO `success_logins` (`id`, `usersId`, `ipAddress`, `userAgent`) VALUES
169(1, 4, '::1', 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'),
170(2, 4, '::1', 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'),
171(3, 4, '::1', 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'),
172(4, 4, '::1', 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'),
173(5, 4, '::1', 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'),
174(6, 4, '::1', 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'),
175(7, 4, '::1', 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'),
176(8, 4, '::1', 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'),
177(9, 4, '::1', 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'),
178(10, 4, '::1', 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'),
179(11, 4, '::1', 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36');
180
181-- --------------------------------------------------------
182
183--
184-- Estructura de tabla para la tabla `users`
185--
186
187CREATE TABLE `users` (
188 `id` int(10) UNSIGNED NOT NULL,
189 `name` varchar(255) NOT NULL,
190 `email` varchar(255) NOT NULL,
191 `password` char(60) NOT NULL,
192 `mustChangePassword` char(1) DEFAULT NULL,
193 `profilesId` int(10) UNSIGNED NOT NULL,
194 `banned` char(1) NOT NULL,
195 `suspended` char(1) NOT NULL,
196 `active` char(1) DEFAULT NULL
197) ENGINE=InnoDB DEFAULT CHARSET=utf8;
198
199--
200-- Volcado de datos para la tabla `users`
201--
202
203INSERT INTO `users` (`id`, `name`, `email`, `password`, `mustChangePassword`, `profilesId`, `banned`, `suspended`, `active`) VALUES
204(1, 'Arnol Manayaye', 'arnol@arnol.com', '$2a$08$Lx1577KNhPa9lzFYKssadetmbhaveRtCoVaOnoXXxUIhrqlCJYWCW', 'N', 2, 'N', 'N', 'Y'),
205(4, 'arnol', 'arnol@gmail.com', '$2y$08$MHdrWmdkcjB5UlFZSFp5YOfbMf6kuYLvV5RoQwkRPuXakDCsv7dai', 'N', 1, 'N', 'N', 'Y');
206
207--
208-- ÃÂndices para tablas volcadas
209--
210
211--
212-- Indices de la tabla `email_confirmations`
213--
214ALTER TABLE `email_confirmations`
215 ADD PRIMARY KEY (`id`);
216
217--
218-- Indices de la tabla `failed_logins`
219--
220ALTER TABLE `failed_logins`
221 ADD PRIMARY KEY (`id`),
222 ADD KEY `usersId` (`usersId`);
223
224--
225-- Indices de la tabla `password_changes`
226--
227ALTER TABLE `password_changes`
228 ADD PRIMARY KEY (`id`),
229 ADD KEY `usersId` (`usersId`);
230
231--
232-- Indices de la tabla `permissions`
233--
234ALTER TABLE `permissions`
235 ADD PRIMARY KEY (`id`),
236 ADD KEY `profilesId` (`profilesId`);
237
238--
239-- Indices de la tabla `profiles`
240--
241ALTER TABLE `profiles`
242 ADD PRIMARY KEY (`id`),
243 ADD KEY `active` (`active`);
244
245--
246-- Indices de la tabla `remember_tokens`
247--
248ALTER TABLE `remember_tokens`
249 ADD PRIMARY KEY (`id`),
250 ADD KEY `token` (`token`);
251
252--
253-- Indices de la tabla `reset_passwords`
254--
255ALTER TABLE `reset_passwords`
256 ADD PRIMARY KEY (`id`),
257 ADD KEY `usersId` (`usersId`);
258
259--
260-- Indices de la tabla `success_logins`
261--
262ALTER TABLE `success_logins`
263 ADD PRIMARY KEY (`id`),
264 ADD KEY `usersId` (`usersId`);
265
266--
267-- Indices de la tabla `users`
268--
269ALTER TABLE `users`
270 ADD PRIMARY KEY (`id`),
271 ADD KEY `profilesId` (`profilesId`);
272
273--
274-- AUTO_INCREMENT de las tablas volcadas
275--
276
277--
278-- AUTO_INCREMENT de la tabla `email_confirmations`
279--
280ALTER TABLE `email_confirmations`
281 MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
282
283--
284-- AUTO_INCREMENT de la tabla `failed_logins`
285--
286ALTER TABLE `failed_logins`
287 MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
288
289--
290-- AUTO_INCREMENT de la tabla `password_changes`
291--
292ALTER TABLE `password_changes`
293 MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
294
295--
296-- AUTO_INCREMENT de la tabla `permissions`
297--
298ALTER TABLE `permissions`
299 MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;
300
301--
302-- AUTO_INCREMENT de la tabla `profiles`
303--
304ALTER TABLE `profiles`
305 MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
306
307--
308-- AUTO_INCREMENT de la tabla `remember_tokens`
309--
310ALTER TABLE `remember_tokens`
311 MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
312
313--
314-- AUTO_INCREMENT de la tabla `reset_passwords`
315--
316ALTER TABLE `reset_passwords`
317 MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
318
319--
320-- AUTO_INCREMENT de la tabla `success_logins`
321--
322ALTER TABLE `success_logins`
323 MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
324
325--
326-- AUTO_INCREMENT de la tabla `users`
327--
328ALTER TABLE `users`
329 MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
330COMMIT;
331
332/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
333/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
334/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;