-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbd.sql
274 lines (229 loc) · 7.87 KB
/
bd.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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
-- phpMyAdmin SQL Dump
-- version 4.6.6deb1+deb.cihar.com~trusty.2
-- https://www.phpmyadmin.net/
--
-- Servidor: localhost
-- Tiempo de generación: 22-01-2018 a las 12:56:32
-- Versión del servidor: 5.5.57-0ubuntu0.14.04.1
-- Versión de PHP: 7.0.24-1+ubuntu14.04.1+deb.sury.org+1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
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: `panda`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `clientes`
--
CREATE TABLE `clientes` (
`id_cliente` int(11) NOT NULL,
`nombre_cliente` varchar(255) NOT NULL,
`telefono_cliente` char(30) NOT NULL,
`email_cliente` varchar(64) NOT NULL,
`direccion_cliente` varchar(255) NOT NULL,
`status_cliente` tinyint(4) NOT NULL,
`date_added` datetime NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `currencies`
--
CREATE TABLE `currencies` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`symbol` varchar(255) NOT NULL,
`precision` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`thousand_separator` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`decimal_separator` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`code` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `currencies`
--
INSERT INTO `currencies` (`id`, `name`, `symbol`, `precision`, `thousand_separator`, `decimal_separator`, `code`) VALUES
(1, 'US Dollar', '$', '2', ',', '.', 'USD');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `detalle_factura`
--
CREATE TABLE `detalle_factura` (
`id_detalle` int(11) NOT NULL,
`numero_factura` int(11) NOT NULL,
`id_producto` int(11) NOT NULL,
`cantidad` int(11) NOT NULL,
`precio_venta` double NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `facturas`
--
CREATE TABLE `facturas` (
`id_factura` int(11) NOT NULL,
`numero_factura` int(11) NOT NULL,
`fecha_factura` datetime NOT NULL,
`id_cliente` int(11) NOT NULL,
`id_vendedor` int(11) NOT NULL,
`condiciones` varchar(30) NOT NULL,
`total_venta` varchar(20) NOT NULL,
`estado_factura` tinyint(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `perfil`
--
CREATE TABLE `perfil` (
`id_perfil` int(11) NOT NULL,
`nombre_empresa` varchar(150) NOT NULL,
`direccion` varchar(255) NOT NULL,
`ciudad` varchar(100) NOT NULL,
`codigo_postal` varchar(100) NOT NULL,
`estado` varchar(100) NOT NULL,
`telefono` varchar(20) NOT NULL,
`email` varchar(64) NOT NULL,
`logo_url` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `perfil`
--
INSERT INTO `perfil` (`id_perfil`, `nombre_empresa`, `direccion`, `ciudad`, `codigo_postal`, `estado`, `telefono`, `email`, `logo_url`) VALUES
(1, 'Empresa', 'Direccion', 'Ciudad', 'Codigo', 'Region', 'Telefono', '[email protected]', 'img/1516640081_avatarr.png');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `products`
--
CREATE TABLE `products` (
`id_producto` int(11) NOT NULL,
`codigo_producto` char(20) NOT NULL,
`nombre_producto` char(255) NOT NULL,
`status_producto` tinyint(4) NOT NULL,
`date_added` datetime NOT NULL,
`precio_producto` double NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tmp`
--
CREATE TABLE `tmp` (
`id_tmp` int(11) NOT NULL,
`id_producto` int(11) NOT NULL,
`cantidad_tmp` int(11) NOT NULL,
`precio_tmp` double(8,2) DEFAULT NULL,
`session_id` varchar(100) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `users`
--
CREATE TABLE `users` (
`user_id` int(11) NOT NULL COMMENT 'auto incrementing user_id of each user, unique index',
`firstname` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
`lastname` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
`user_name` varchar(64) COLLATE utf8_unicode_ci NOT NULL COMMENT 'user''s name, unique',
`user_password_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'user''s password in salted and hashed format',
`user_email` varchar(64) COLLATE utf8_unicode_ci NOT NULL COMMENT 'user''s email, unique',
`date_added` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='user data';
--
-- Volcado de datos para la tabla `users`
--
INSERT INTO `users` (`user_id`, `firstname`, `lastname`, `user_name`, `user_password_hash`, `user_email`, `date_added`) VALUES
(1, 'Admin', 'Admin', 'admin', '$2y$10$5Se56VWP29j9cN2L/enF5OBgiq9bszT0Z5dGAqudVlmLXFmpIEURq', '[email protected]', '2016-05-21 15:06:00');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `clientes`
--
ALTER TABLE `clientes`
ADD PRIMARY KEY (`id_cliente`),
ADD UNIQUE KEY `codigo_producto` (`nombre_cliente`);
--
-- Indices de la tabla `currencies`
--
ALTER TABLE `currencies`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `detalle_factura`
--
ALTER TABLE `detalle_factura`
ADD PRIMARY KEY (`id_detalle`),
ADD KEY `numero_cotizacion` (`numero_factura`,`id_producto`);
--
-- Indices de la tabla `facturas`
--
ALTER TABLE `facturas`
ADD PRIMARY KEY (`id_factura`),
ADD UNIQUE KEY `numero_cotizacion` (`numero_factura`);
--
-- Indices de la tabla `perfil`
--
ALTER TABLE `perfil`
ADD PRIMARY KEY (`id_perfil`);
--
-- Indices de la tabla `products`
--
ALTER TABLE `products`
ADD PRIMARY KEY (`id_producto`),
ADD UNIQUE KEY `codigo_producto` (`codigo_producto`);
--
-- Indices de la tabla `tmp`
--
ALTER TABLE `tmp`
ADD PRIMARY KEY (`id_tmp`);
--
-- Indices de la tabla `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`user_id`),
ADD UNIQUE KEY `user_name` (`user_name`),
ADD UNIQUE KEY `user_email` (`user_email`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `clientes`
--
ALTER TABLE `clientes`
MODIFY `id_cliente` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT de la tabla `currencies`
--
ALTER TABLE `currencies`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=34;
--
-- AUTO_INCREMENT de la tabla `detalle_factura`
--
ALTER TABLE `detalle_factura`
MODIFY `id_detalle` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT de la tabla `facturas`
--
ALTER TABLE `facturas`
MODIFY `id_factura` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT de la tabla `perfil`
--
ALTER TABLE `perfil`
MODIFY `id_perfil` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT de la tabla `products`
--
ALTER TABLE `products`
MODIFY `id_producto` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT de la tabla `tmp`
--
ALTER TABLE `tmp`
MODIFY `id_tmp` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT de la tabla `users`
--
ALTER TABLE `users`
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'auto incrementing user_id of each user, unique index', AUTO_INCREMENT=3;
/*!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 */;