forked from alfredogon82/ticketsapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathticketsapi.sql
197 lines (159 loc) · 5.12 KB
/
ticketsapi.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
-- phpMyAdmin SQL Dump
-- version 4.9.5deb2
-- https://www.phpmyadmin.net/
--
-- Servidor: localhost:3306
-- Tiempo de generación: 10-08-2021 a las 01:21:54
-- Versión del servidor: 8.0.23-0ubuntu0.20.04.1
-- Versión de PHP: 7.4.3
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 */;
--
-- Base de datos: `ticketsapi`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `state`
--
CREATE TABLE `state` (
`id` int NOT NULL,
`name` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Volcado de datos para la tabla `state`
--
INSERT INTO `state` (`id`, `name`) VALUES
(1, 'inicial');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tickets`
--
CREATE TABLE `tickets` (
`id` int NOT NULL,
`user_id` int NOT NULL,
`state_id` int NOT NULL,
`title` varchar(255) DEFAULT NULL,
`text` varchar(255) DEFAULT NULL,
`active` varchar(1) DEFAULT NULL,
`date` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Volcado de datos para la tabla `tickets`
--
INSERT INTO `tickets` (`id`, `user_id`, `state_id`, `title`, `text`, `active`, `date`) VALUES
(1, 1, 1, 'titulo!', 'texto del titulo!', '1', NULL),
(2, 1, 1, 'ticket prueba', 'texto!', '1', NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `users`
--
CREATE TABLE `users` (
`id` int NOT NULL,
`id_user_type` int NOT NULL,
`name` varchar(255) DEFAULT NULL,
`lastname` varchar(255) DEFAULT NULL,
`email` varchar(45) DEFAULT NULL,
`password` longtext,
`active` varchar(1) DEFAULT NULL,
`date` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Volcado de datos para la tabla `users`
--
INSERT INTO `users` (`id`, `id_user_type`, `name`, `lastname`, `email`, `password`, `active`, `date`) VALUES
(1, 1, 'alfredotest', 'gonzaleztest', '[email protected]', '9726caea40f8377550d14e46c805f35f78f14863', '1', NULL),
(2, 1, 'alfredo', 'gonzalez', '[email protected]', 'wefafa', NULL, NULL),
(3, 1, 'alfredo', 'gonzalez', '[email protected]', '1q2w3e4r5T', NULL, NULL),
(4, 1, 'alfredo', 'gonzalez', '[email protected]', '1q2w3e4r5T', NULL, NULL),
(5, 1, 'alfredo', 'gonzalez', '[email protected]', '1q2w3e4r5T', NULL, NULL),
(6, 1, 'alfredo', 'gonzalez', '[email protected]', '9726caea40f8377550d14e46c805f35f78f14863', NULL, NULL),
(7, 1, 'alfredo', 'gonzalez', '[email protected]', '9726caea40f8377550d14e46c805f35f78f14863', NULL, NULL),
(8, 1, 'alfredo', 'gonzalez', '[email protected]', '1', NULL, NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `user_type`
--
CREATE TABLE `user_type` (
`id` int NOT NULL,
`name` varchar(45) DEFAULT NULL,
`active` varchar(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Volcado de datos para la tabla `user_type`
--
INSERT INTO `user_type` (`id`, `name`, `active`) VALUES
(1, 'regular', '0'),
(2, 'admin', '0');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `state`
--
ALTER TABLE `state`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `tickets`
--
ALTER TABLE `tickets`
ADD PRIMARY KEY (`id`,`user_id`,`state_id`),
ADD KEY `fk_tickets_users1_idx` (`user_id`),
ADD KEY `fk_tickets_state1_idx` (`state_id`);
--
-- Indices de la tabla `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD KEY `fk_users_user_type_idx` (`id_user_type`);
--
-- Indices de la tabla `user_type`
--
ALTER TABLE `user_type`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `state`
--
ALTER TABLE `state`
MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT de la tabla `tickets`
--
ALTER TABLE `tickets`
MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de la tabla `users`
--
ALTER TABLE `users`
MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT de la tabla `user_type`
--
ALTER TABLE `user_type`
MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `tickets`
--
ALTER TABLE `tickets`
ADD CONSTRAINT `fk_tickets_state1` FOREIGN KEY (`state_id`) REFERENCES `state` (`id`),
ADD CONSTRAINT `fk_tickets_users1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);
--
-- Filtros para la tabla `users`
--
ALTER TABLE `users`
ADD CONSTRAINT `fk_users_user_type` FOREIGN KEY (`id_user_type`) REFERENCES `user_type` (`id`);
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 */;