-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathET3_BD.sql
297 lines (240 loc) · 8.61 KB
/
ET3_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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
-- phpMyAdmin SQL Dump
-- version 4.6.6deb4
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Oct 20, 2017 at 10:08 AM
-- Server version: 10.1.26-MariaDB-0+deb9u1
-- PHP Version: 7.0.19-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 */;
--
-- Database: `IUET32017`
--
-- jrodeiro - 7/10/2017
-- script de creación de la bd, usuario, asignación de privilegios a ese usuario sobre la bd
-- creación de tabla e insert sobre la misma.
--
-- CREAR LA BD BORRANDOLA SI YA EXISTIESE
--
DROP DATABASE IF EXISTS `IUET32017`;
CREATE DATABASE `IUET32017` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
--
-- SELECCIONAMOS PARA USAR
--
USE `IUET32017`;
--
-- DAMOS PERMISO USO Y BORRAMOS EL USUARIO QUE QUEREMOS CREAR POR SI EXISTE
--
GRANT USAGE ON * . * TO `userET3`@`localhost`;
DROP USER `userET3`@`localhost`;
--
-- CREAMOS EL USUARIO Y LE DAMOS PASSWORD,DAMOS PERMISO DE USO Y DAMOS PERMISOS SOBRE LA BASE DE DATOS.
--
CREATE USER IF NOT EXISTS `userET3`@`localhost` IDENTIFIED BY 'passET3';
GRANT USAGE ON *.* TO `userET3`@`localhost` REQUIRE NONE WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;
GRANT ALL PRIVILEGES ON `IUET32017`.* TO `userET3`@`localhost` WITH GRANT OPTION;
-- --------------------------------------------------------
-- --------------------------------------------------------
--
-- Table structure for table `PERMISO`
--
CREATE TABLE `PERMISO` (
`IdGrupo` varchar(6) COLLATE latin1_spanish_ci NOT NULL,
`IdFuncionalidad` varchar(6) COLLATE latin1_spanish_ci NOT NULL,
`IdAccion` varchar(6) COLLATE latin1_spanish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
--
-- Table structure for table `FUNC_ACCION`
--
CREATE TABLE `FUNC_ACCION` (
`IdFuncionalidad` varchar(6) COLLATE latin1_spanish_ci NOT NULL,
`IdAccion` varchar(6) COLLATE latin1_spanish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
--
-- Table structure for table `USUARIO_GRUPO`
--
CREATE TABLE `USU_GRUPO` (
`login` varchar(9) COLLATE latin1_spanish_ci NOT NULL,
`IdGrupo` varchar(6) COLLATE latin1_spanish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
--
-- Table structure for table `ACCION`
--
CREATE TABLE `ACCION` (
`IdAccion` varchar(6) COLLATE latin1_spanish_ci NOT NULL,
`NombreAccion` varchar(60) COLLATE latin1_spanish_ci NOT NULL,
`DescripAccion` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `FUNCIONALIDAD`
--
CREATE TABLE `FUNCIONALIDAD` (
`IdFuncionalidad` varchar(6) COLLATE latin1_spanish_ci NOT NULL,
`NombreFuncionalidad` varchar(60) COLLATE latin1_spanish_ci NOT NULL,
`DescripFuncionalidad` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `GRUPO`
--
CREATE TABLE `GRUPO` (
`IdGrupo` varchar(6) COLLATE latin1_spanish_ci NOT NULL,
`NombreGrupo` varchar(60) COLLATE latin1_spanish_ci NOT NULL,
`DescripGrupo` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `TRABAJO`
--
CREATE TABLE `TRABAJO` (
`IdTrabajo` varchar(6) COLLATE latin1_spanish_ci NOT NULL,
`NombreTrabajo` varchar(60) COLLATE latin1_spanish_ci NOT NULL,
`FechaIniTrabajo` date NOT NULL,
`FechaFinTrabajo` date NOT NULL,
`PorcentajeNota` decimal(2,0) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `EVALUACION`
--
-- OK : indicación de si esta correcta o no la QA (1 correcto, 0 Incorrecto)
-- CorrectoP : Indicación de si esta correcta la historia de la ET
-- CorrectoA : evaluación de la historia por parte del alumno evaluador de esa historia de esa ET
CREATE TABLE `EVALUACION` (
`IdTrabajo` varchar(6) COLLATE latin1_spanish_ci NOT NULL,
`LoginEvaluador` varchar(9) COLLATE latin1_spanish_ci NOT NULL,
`AliasEvaluado` varchar(6) COLLATE latin1_spanish_ci NOT NULL,
`IdHistoria` int(2) NOT NULL,
`CorrectoA` tinyint(1) NOT NULL,
`ComenIncorrectoA` varchar(300) COLLATE latin1_spanish_ci NOT NULL,
`CorrectoP` tinyint(1) NOT NULL,
`ComentIncorrectoP` varchar(300) COLLATE latin1_spanish_ci NOT NULL,
`OK` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `HISTORIA`
--
CREATE TABLE `HISTORIA` (
`IdTrabajo` varchar(6) COLLATE latin1_spanish_ci NOT NULL,
`IdHistoria` int(2) NOT NULL,
`TextoHistoria` varchar(300) COLLATE latin1_spanish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `NOTASTRABAJO`
--
CREATE TABLE `NOTA_TRABAJO` (
`login` varchar(9) COLLATE latin1_spanish_ci NOT NULL,
`IdTrabajo` varchar(6) COLLATE latin1_spanish_ci NOT NULL,
`NotaTrabajo` decimal(4,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `QA`
--
CREATE TABLE `ASIGNAC_QA` (
`IdTrabajo` varchar(6) COLLATE latin1_spanish_ci NOT NULL,
`LoginEvaluador` varchar(9) COLLATE latin1_spanish_ci NOT NULL,
`LoginEvaluado` varchar(9) COLLATE latin1_spanish_ci NOT NULL,
`AliasEvaluado` varchar(6) COLLATE latin1_spanish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `ENTREGA`
--
CREATE TABLE `ENTREGA` (
`login` varchar(9) COLLATE latin1_spanish_ci NOT NULL,
`IdTrabajo` varchar(6) COLLATE latin1_spanish_ci NOT NULL,
`Alias` varchar(6) COLLATE latin1_spanish_ci NOT NULL,
`Horas` int(2) DEFAULT NULL,
`Ruta` varchar(60) COLLATE latin1_spanish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `USUARIO`
--
CREATE TABLE `USUARIO` (
`login` varchar(9) COLLATE latin1_spanish_ci NOT NULL,
`password` varchar(128) COLLATE latin1_spanish_ci NOT NULL,
`DNI` varchar(9) COLLATE latin1_spanish_ci NOT NULL,
`Nombre` varchar(30) COLLATE latin1_spanish_ci NOT NULL,
`Apellidos` varchar(50) COLLATE latin1_spanish_ci NOT NULL,
`Correo` varchar(40) COLLATE latin1_spanish_ci NOT NULL,
`Direccion` varchar(60) COLLATE latin1_spanish_ci NOT NULL,
`Telefono` varchar(11) COLLATE latin1_spanish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
--
-- Indexes for table `TRABAJO`
--
ALTER TABLE `TRABAJO`
ADD PRIMARY KEY (`IdTrabajo`);
--
-- Indexes for table `EVALUACION`
--
ALTER TABLE `EVALUACION`
ADD PRIMARY KEY (`IdTrabajo`,`AliasEvaluado`,`LoginEvaluador`,`IdHistoria`);
--
-- Indexes for table `HISTORIA`
--
ALTER TABLE `HISTORIA`
ADD PRIMARY KEY (`IdTrabajo`,`IdHistoria`);
--
-- Indexes for table `NOTASTRABAJO`
--
ALTER TABLE `NOTA_TRABAJO`
ADD PRIMARY KEY (`login`,`IdTrabajo`);
--
-- Indexes for table `QA`
--
ALTER TABLE `ASIGNAC_QA`
ADD PRIMARY KEY (`IdTrabajo`,`LoginEvaluador`,`AliasEvaluado`);
--
-- Indexes for table `ENTREGA`
--
ALTER TABLE `ENTREGA`
ADD PRIMARY KEY (`login`,`IdTrabajo`);
--
-- Indexes for table `USUARIO`
--
ALTER TABLE `USUARIO`
ADD PRIMARY KEY (`login`);
--
-- Indexes for table `GRUPO`
--
ALTER TABLE `GRUPO`
ADD PRIMARY KEY (`IdGrupo`);
--
-- Indexes for table `FUNCIONALIDAD`
--
ALTER TABLE `FUNCIONALIDAD`
ADD PRIMARY KEY (`IdFuncionalidad`);
--
-- Indexes for table `ACCION`
--
ALTER TABLE `ACCION`
ADD PRIMARY KEY (`IdAccion`);
--
-- Indexes for table `USUARIO_GRUPO`
--
ALTER TABLE `USU_GRUPO`
ADD PRIMARY KEY (`login`,`IdGrupo`);
--
-- Indexes for table `FUNC_ACCION`
--
ALTER TABLE `FUNC_ACCION`
ADD PRIMARY KEY (`IdFuncionalidad`,`IdAccion`);
--
-- Indexes for table `PERMISO`
--
ALTER TABLE `PERMISO`
ADD PRIMARY KEY (`IdGrupo`,`IdFuncionalidad`,`IdAccion`);
/*!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 */;