-
Notifications
You must be signed in to change notification settings - Fork 0
/
database_struct.sql
181 lines (151 loc) · 4.89 KB
/
database_struct.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
-- phpMyAdmin SQL Dump
-- version 4.3.13.1
-- http://www.phpmyadmin.net
--
-- Servidor: localhost
-- Tiempo de generación: 08-06-2020 a las 20:06:39
-- Versión del servidor: 5.6.25
-- Versión de PHP: 5.4.43
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 utf8 */;
--
-- Base de datos: `depilaser`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `bodyparts`
--
CREATE TABLE IF NOT EXISTS `bodyparts` (
`id` int(11) NOT NULL,
`idproduct` int(11) NOT NULL,
`bodypart` varchar(100) COLLATE utf8_spanish_ci NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `clients`
--
CREATE TABLE IF NOT EXISTS `clients` (
`id` int(11) NOT NULL,
`name` varchar(100) COLLATE utf8_spanish_ci NOT NULL,
`lastname` varchar(100) COLLATE utf8_spanish_ci NOT NULL,
`yearborn` int(4) NOT NULL,
`sex` varchar(6) COLLATE utf8_spanish_ci NOT NULL,
`address` varchar(250) COLLATE utf8_spanish_ci NOT NULL,
`phone` varchar(20) COLLATE utf8_spanish_ci NOT NULL,
`email` varchar(100) COLLATE utf8_spanish_ci NOT NULL,
`coloreyes` varchar(60) COLLATE utf8_spanish_ci DEFAULT NULL,
`colorhair` varchar(60) COLLATE utf8_spanish_ci DEFAULT NULL,
`skintype` varchar(60) COLLATE utf8_spanish_ci NOT NULL,
`other` tinytext COLLATE utf8_spanish_ci,
`dateadded` date NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `consumptions`
--
CREATE TABLE IF NOT EXISTS `consumptions` (
`id` int(11) NOT NULL,
`idorder` int(11) NOT NULL,
`idbodypart` int(11) NOT NULL,
`skintype` varchar(50) COLLATE utf8_spanish_ci NOT NULL,
`other` varchar(300) COLLATE utf8_spanish_ci NOT NULL,
`datetimeadded` datetime NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `orders`
--
CREATE TABLE IF NOT EXISTS `orders` (
`id` int(11) NOT NULL,
`idclient` int(11) NOT NULL,
`idproduct` int(11) NOT NULL,
`type` varchar(1) COLLATE utf8_spanish_ci NOT NULL,
`credits` int(11) NOT NULL,
`paid` int(1) NOT NULL,
`dateadded` date NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `products`
--
CREATE TABLE IF NOT EXISTS `products` (
`id` int(11) NOT NULL,
`name` varchar(100) COLLATE utf8_spanish_ci NOT NULL,
`description` tinytext COLLATE utf8_spanish_ci NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `bodyparts`
--
ALTER TABLE `bodyparts`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `clients`
--
ALTER TABLE `clients`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `consumptions`
--
ALTER TABLE `consumptions`
ADD PRIMARY KEY (`id`), ADD KEY `idorder` (`idorder`);
--
-- Indices de la tabla `orders`
--
ALTER TABLE `orders`
ADD PRIMARY KEY (`id`), ADD KEY `idclient` (`idclient`);
--
-- Indices de la tabla `products`
--
ALTER TABLE `products`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `bodyparts`
--
ALTER TABLE `bodyparts`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=22;
--
-- AUTO_INCREMENT de la tabla `clients`
--
ALTER TABLE `clients`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=22;
--
-- AUTO_INCREMENT de la tabla `consumptions`
--
ALTER TABLE `consumptions`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT de la tabla `orders`
--
ALTER TABLE `orders`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT de la tabla `products`
--
ALTER TABLE `products`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=7;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `consumptions`
--
ALTER TABLE `consumptions`
ADD CONSTRAINT `consumptions_ibfk_1` FOREIGN KEY (`idorder`) REFERENCES `orders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Filtros para la tabla `orders`
--
ALTER TABLE `orders`
ADD CONSTRAINT `orders_ibfk_1` FOREIGN KEY (`idclient`) REFERENCES `clients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!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 */;