-
Notifications
You must be signed in to change notification settings - Fork 0
/
database.sql
339 lines (310 loc) · 12.3 KB
/
database.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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
-- MySQL dump 10.13 Distrib 8.0.38, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: backend
-- ------------------------------------------------------
-- Server version 8.0.39
/*!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 */;
/*!50503 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `actions`
--
DROP TABLE IF EXISTS `actions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `actions` (
`ID` char(36) NOT NULL,
`ActionName` varchar(50) NOT NULL,
`Created` datetime DEFAULT CURRENT_TIMESTAMP,
`Updated` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `catassets`
--
DROP TABLE IF EXISTS `catassets`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `catassets` (
`ID` char(36) NOT NULL,
`Name` varchar(100) NOT NULL,
`Description` varchar(255) DEFAULT NULL,
`PurchaseDate` date DEFAULT NULL,
`Cost` decimal(10,2) DEFAULT '0.00',
`Location` varchar(100) DEFAULT NULL,
`Condition` varchar(20) DEFAULT NULL,
`Status` varchar(20) DEFAULT 'active',
`LastMaintenanceDate` date DEFAULT NULL,
`WarrantyEndDate` date DEFAULT NULL,
`Created` datetime DEFAULT CURRENT_TIMESTAMP,
`Updated` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `catinventory`
--
DROP TABLE IF EXISTS `catinventory`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `catinventory` (
`ID` char(36) NOT NULL,
`ItemCode` varchar(50) NOT NULL,
`Name` varchar(100) NOT NULL,
`Description` varchar(255) DEFAULT NULL,
`Quantity` int DEFAULT '0',
`Weight` decimal(10,2) DEFAULT NULL,
`Dimensions` varchar(50) DEFAULT NULL,
`Location` varchar(100) DEFAULT NULL,
`Condition` varchar(20) DEFAULT NULL,
`PurchaseDate` date DEFAULT NULL,
`Created` datetime DEFAULT CURRENT_TIMESTAMP,
`Updated` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `catsupplies`
--
DROP TABLE IF EXISTS `catsupplies`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `catsupplies` (
`ID` char(36) NOT NULL,
`Name` varchar(100) NOT NULL,
`Description` varchar(255) DEFAULT NULL,
`Quantity` int DEFAULT '0',
`Unit` varchar(50) DEFAULT NULL,
`Supplier` varchar(100) DEFAULT NULL,
`PurchaseDate` date DEFAULT NULL,
`ExpiryDate` date DEFAULT NULL,
`Cost` decimal(10,2) DEFAULT '0.00',
`Status` varchar(20) DEFAULT 'Active',
`Created` datetime DEFAULT CURRENT_TIMESTAMP,
`Updated` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `diagnostic`
--
DROP TABLE IF EXISTS `diagnostic`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `diagnostic` (
`ID` char(36) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `modules`
--
DROP TABLE IF EXISTS `modules`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `modules` (
`ID` char(36) NOT NULL,
`ModuleName` varchar(100) NOT NULL,
`Created` datetime DEFAULT CURRENT_TIMESTAMP,
`Updated` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `parents`
--
DROP TABLE IF EXISTS `parents`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `parents` (
`ID` char(36) NOT NULL,
`TeacherID` char(36) NOT NULL,
`FirstName` varchar(100) NOT NULL,
`LastName` varchar(100) NOT NULL,
`DateOfBirth` date NOT NULL,
`Ocupation` varchar(60) NOT NULL,
`Gender` varchar(10) NOT NULL,
`Curp` varchar(20) NOT NULL,
`Email` varchar(100) NOT NULL,
`Phone` bigint NOT NULL,
`Age` int NOT NULL,
`Address` varchar(200) NOT NULL,
`EmergencyContact` varchar(100) NOT NULL,
`EmergencyPhone` varchar(15) NOT NULL,
`Created` datetime DEFAULT (now()),
`Updated` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`Status` varchar(20) DEFAULT 'Activo',
PRIMARY KEY (`ID`,`TeacherID`),
KEY `fk_teacher` (`TeacherID`),
CONSTRAINT `fk_teacher` FOREIGN KEY (`TeacherID`) REFERENCES `teachers` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `permissions`
--
DROP TABLE IF EXISTS `permissions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `permissions` (
`ID` char(36) NOT NULL,
`ModuleID` char(36) NOT NULL,
`ActionID` char(36) NOT NULL,
`Created` datetime DEFAULT CURRENT_TIMESTAMP,
`Updated` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`ID`),
KEY `ModuleID` (`ModuleID`),
KEY `ActionID` (`ActionID`),
CONSTRAINT `permissions_ibfk_1` FOREIGN KEY (`ModuleID`) REFERENCES `modules` (`ID`),
CONSTRAINT `permissions_ibfk_2` FOREIGN KEY (`ActionID`) REFERENCES `actions` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `student_teacher_history`
--
DROP TABLE IF EXISTS `student_teacher_history`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `student_teacher_history` (
`ID` char(36) NOT NULL,
`StudentID` char(36) NOT NULL,
`TeacherID` char(36) NOT NULL,
`Grade` varchar(50) NOT NULL,
`Group` varchar(10) NOT NULL,
`StartDate` date NOT NULL,
`EndDate` date DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `StudentID` (`StudentID`),
KEY `TeacherID` (`TeacherID`),
CONSTRAINT `student_teacher_history_ibfk_1` FOREIGN KEY (`StudentID`) REFERENCES `students` (`ID`),
CONSTRAINT `student_teacher_history_ibfk_2` FOREIGN KEY (`TeacherID`) REFERENCES `teachers` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `students`
--
DROP TABLE IF EXISTS `students`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `students` (
`ID` char(36) NOT NULL,
`IDTeacher` char(36) NOT NULL,
`IDMom` char(36) NOT NULL,
`IDDad` char(36) NOT NULL,
`NameStudent` varchar(100) NOT NULL,
`Grade` varchar(50) NOT NULL,
`Group` varchar(10) NOT NULL,
`AgeStudent` int NOT NULL,
`Curp` varchar(20) NOT NULL,
`DateOfBirth` date NOT NULL,
`Gender` varchar(10) NOT NULL,
`Address` varchar(200) NOT NULL,
`NameOfMom` varchar(100) NOT NULL,
`NameOfDad` varchar(100) NOT NULL,
`EmergencyContact` varchar(100) NOT NULL,
`EmergencyPhone` varchar(15) NOT NULL,
`Allergies` varchar(255) NOT NULL,
`MedicalConditions` varchar(255) NOT NULL,
`EnrollmentDate` date NOT NULL,
`Created` datetime DEFAULT CURRENT_TIMESTAMP,
`Updated` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`Status` int DEFAULT '5',
PRIMARY KEY (`ID`),
KEY `IDMom` (`IDMom`),
KEY `IDDad` (`IDDad`),
KEY `IDTeacher` (`IDTeacher`),
CONSTRAINT `students_ibfk_1` FOREIGN KEY (`IDMom`) REFERENCES `parents` (`ID`),
CONSTRAINT `students_ibfk_2` FOREIGN KEY (`IDMom`) REFERENCES `parents` (`ID`),
CONSTRAINT `students_ibfk_3` FOREIGN KEY (`IDDad`) REFERENCES `parents` (`ID`),
CONSTRAINT `students_ibfk_4` FOREIGN KEY (`IDTeacher`) REFERENCES `parents` (`TeacherID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `teachers`
--
DROP TABLE IF EXISTS `teachers`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `teachers` (
`ID` char(36) NOT NULL,
`TeacherID` char(36) NOT NULL,
`FirstName` varchar(100) NOT NULL,
`LastName` varchar(100) NOT NULL,
`DateOfBirth` date DEFAULT NULL,
`NameSchool` varchar(150) NOT NULL,
`LevelStudies` varchar(45) NOT NULL,
`StudentsInCharge` int NOT NULL,
`Grade` varchar(50) NOT NULL,
`Group` varchar(10) NOT NULL,
`CCT` varchar(45) NOT NULL,
`SchoolZone` varchar(15) NOT NULL,
`WorkShift` varchar(45) NOT NULL,
`Curp` varchar(20) NOT NULL,
`Email` varchar(100) NOT NULL,
`Phone` varchar(15) NOT NULL,
`Age` int NOT NULL,
`Address` varchar(255) NOT NULL,
`EmergencyContact` varchar(100) NOT NULL,
`EmergencyPhone` varchar(15) NOT NULL,
`Created` datetime DEFAULT (now()),
`Updated` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`Status` varchar(20) DEFAULT 'Activo',
PRIMARY KEY (`ID`,`TeacherID`),
KEY `teachers_ibfk_1` (`TeacherID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_permissions`
--
DROP TABLE IF EXISTS `user_permissions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user_permissions` (
`ID` char(36) NOT NULL,
`UserID` char(36) NOT NULL,
`PermitID` char(36) NOT NULL,
`Created` datetime DEFAULT CURRENT_TIMESTAMP,
`Updated` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`ID`),
KEY `PermitID` (`PermitID`),
KEY `user_permissions_ibfk_1` (`UserID`),
CONSTRAINT `user_permissions_ibfk_1` FOREIGN KEY (`UserID`) REFERENCES `users` (`ID`) ON DELETE CASCADE,
CONSTRAINT `user_permissions_ibfk_2` FOREIGN KEY (`PermitID`) REFERENCES `permissions` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `users` (
`ID` char(36) NOT NULL,
`NameUser` varchar(100) NOT NULL,
`Email` varchar(100) NOT NULL,
`Password` char(150) NOT NULL,
`Role` varchar(50) DEFAULT NULL,
`LastLogin` datetime DEFAULT NULL,
`AccountStatus` varchar(20) DEFAULT 'Activo',
`Created` datetime DEFAULT CURRENT_TIMESTAMP,
`Updated` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`ID`),
UNIQUE KEY `Email` (`Email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!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 */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2024-10-21 23:37:12