errors in database files fixed

parent 32790c89
...@@ -14,8 +14,8 @@ SET foreign_key_checks=0; ...@@ -14,8 +14,8 @@ SET foreign_key_checks=0;
-- --
-- Default supervisor (ID -1) for PCB autonomous mode -- Default supervisor (ID -1) for PCB autonomous mode
-- --
INSERT INTO `supervisor` (`id`, `name`, `surname`, `gender`, `pic`, `address`, `country`, `email`, `phone`, `lang`, `tts_engine`, `password`, `id_off`, `active`) VALUES INSERT INTO `supervisor` (`id`, `name`, `surname`, `gender`, `pic`, `address`, `country`, `email`, `phone`, `lang`, `tts_engine`, `password`, `active`) VALUES
('-1', 'none', 'none', 'M', 'defaultAvatar.jpg', NULL, NULL, '', NULL, 'es-es', NULL, '', NULL, '0'); ('-1', 'none', 'none', 'M', 'defaultAvatar.jpg', NULL, NULL, '', NULL, 'es-es', NULL, '', '0');
-- --
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
-- --
DROP TABLE IF EXISTS `action`; DROP TABLE IF EXISTS `action`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `action` ( CREATE TABLE `action` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`type` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `type` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
...@@ -43,119 +41,6 @@ CREATE TABLE `action` ( ...@@ -43,119 +41,6 @@ CREATE TABLE `action` (
CONSTRAINT `fk_sup_act` FOREIGN KEY (`id_sup`) REFERENCES `supervisor` (`id`), CONSTRAINT `fk_sup_act` FOREIGN KEY (`id_sup`) REFERENCES `supervisor` (`id`),
CONSTRAINT `fk_try_act` FOREIGN KEY (`id_try`) REFERENCES `try` (`id`) ON DELETE SET NULL CONSTRAINT `fk_try_act` FOREIGN KEY (`id_try`) REFERENCES `try` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=104 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='This table registers and action performed by a user at a given time, all information of the action is in JSON format in the ''description'' column and the operation performed is one of the possible for the ''type'' column. NOTE: timestamps must support fractional seconds, so MySQL versions >= 5.6.4 are required.'; ) ENGINE=InnoDB AUTO_INCREMENT=104 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='This table registers and action performed by a user at a given time, all information of the action is in JSON format in the ''description'' column and the operation performed is one of the possible for the ''type'' column. NOTE: timestamps must support fractional seconds, so MySQL versions >= 5.6.4 are required.';
/*!40101 SET character_set_client = @saved_cs_client */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER TRG_NEW_EVENT_ONSESSION
BEFORE INSERT ON action
FOR EACH ROW
thisTrigger: BEGIN
DECLARE idstu INT;
DECLARE idtry INT;
IF ((@TRIGGER_CHECKS = FALSE)
OR (@TRIGGER_BEFORE_INSERT_CHECKS = FALSE))
AND (USER() = 'root@localhost')
THEN
LEAVE thisTrigger;
END IF;
SELECT id_opentry INTO idtry
FROM
stu_opentry
WHERE
id_stu = NEW.id_stu;
IF (idtry IS NOT NULL) THEN
SET NEW.id_try = idtry;
END IF;
IF (NEW.type = 'resumesession')
THEN
SET NEW.id_try=NULL;
END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER TRG_NEW_EVENT
AFTER INSERT ON action
FOR EACH ROW
thisTrigger: BEGIN
DECLARE idopentry INT;
DECLARE idws INT;
IF ((@TRIGGER_CHECKS = FALSE)
OR (@TRIGGER_AFTER_INSERT_CHECKS = FALSE))
AND (USER() = 'root@localhost')
THEN
LEAVE thisTrigger;
END IF;
SELECT id_ws, id_opentry INTO idws, idopentry
FROM
stu_opentry
WHERE
id_stu = NEW.id_stu;
IF (NEW.id_try IS NOT NULL) THEN
UPDATE `try`
SET
end = NEW.timestamp
WHERE
id = idopentry;
END IF;
CASE NEW.type
WHEN 'Show' THEN
INSERT INTO try(`id_ws`)
VALUES (idws);
WHEN 'pausesession' THEN
IF (idopentry IS NOT NULL) THEN
UPDATE try
SET
result = 'DISCARDED'
WHERE
id = idopentry;
END IF;
WHEN 'resumesession' THEN
INSERT INTO try(`id_ws`)
VALUES (idws);
ELSE BEGIN END;
END CASE;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
-- --
-- Table structure for table `catexp` -- Table structure for table `catexp`
...@@ -172,7 +57,6 @@ CREATE TABLE `catexp` ( ...@@ -172,7 +57,6 @@ CREATE TABLE `catexp` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `exp` (`exp`,`lang`) UNIQUE KEY `exp` (`exp`,`lang`)
) ENGINE=InnoDB AUTO_INCREMENT=27958 DEFAULT CHARSET=latin1 COMMENT='Stores the expressions available in several languages for a given category (id_cat)'; ) ENGINE=InnoDB AUTO_INCREMENT=27958 DEFAULT CHARSET=latin1 COMMENT='Stores the expressions available in several languages for a given category (id_cat)';
/*!40101 SET character_set_client = @saved_cs_client */;
-- --
-- Table structure for table `instruction` -- Table structure for table `instruction`
...@@ -194,7 +78,6 @@ CREATE TABLE `instruction` ( ...@@ -194,7 +78,6 @@ CREATE TABLE `instruction` (
KEY `ix_instruction_begin` (`begin`), KEY `ix_instruction_begin` (`begin`),
CONSTRAINT `fk_met_ins` FOREIGN KEY (`id_met`) REFERENCES `method` (`id`) CONSTRAINT `fk_met_ins` FOREIGN KEY (`id_met`) REFERENCES `method` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='An instruction is a ''phase'' in a method for learning AAC'; ) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='An instruction is a ''phase'' in a method for learning AAC';
/*!40101 SET character_set_client = @saved_cs_client */;
-- --
-- Table structure for table `license` -- Table structure for table `license`
...@@ -217,7 +100,6 @@ CREATE TABLE `license` ( ...@@ -217,7 +100,6 @@ CREATE TABLE `license` (
UNIQUE KEY `number` (`number`), UNIQUE KEY `number` (`number`),
KEY `id_stu` (`id_stu`) KEY `id_stu` (`id_stu`)
) ENGINE=InnoDB AUTO_INCREMENT=147 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Student license number'; ) ENGINE=InnoDB AUTO_INCREMENT=147 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Student license number';
/*!40101 SET character_set_client = @saved_cs_client */;
-- --
-- Table structure for table `meta_instruction` -- Table structure for table `meta_instruction`
...@@ -234,15 +116,12 @@ CREATE TABLE `meta_instruction` ( ...@@ -234,15 +116,12 @@ CREATE TABLE `meta_instruction` (
`lang` char(5) COLLATE utf8_unicode_ci NOT NULL, `lang` char(5) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='One in a set of instructions predefined or stored by users. They are related to a metamethod (id_met)'; ) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='One in a set of instructions predefined or stored by users. They are related to a metamethod (id_met)';
/*!40101 SET character_set_client = @saved_cs_client */;
-- --
-- Table structure for table `meta_method` -- Table structure for table `meta_method`
-- --
DROP TABLE IF EXISTS `meta_method`; DROP TABLE IF EXISTS `meta_method`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `meta_method` ( CREATE TABLE `meta_method` (
`id` tinyint(4) NOT NULL AUTO_INCREMENT, `id` tinyint(4) NOT NULL AUTO_INCREMENT,
`name` varchar(60) COLLATE utf8_unicode_ci NOT NULL, `name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
...@@ -252,15 +131,12 @@ CREATE TABLE `meta_method` ( ...@@ -252,15 +131,12 @@ CREATE TABLE `meta_method` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`,`id_sup`) UNIQUE KEY `name` (`name`,`id_sup`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Methods predefined in the platform or stored by users for cloning'; ) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Methods predefined in the platform or stored by users for cloning';
/*!40101 SET character_set_client = @saved_cs_client */;
-- --
-- Table structure for table `method` -- Table structure for table `method`
-- --
DROP TABLE IF EXISTS `method`; DROP TABLE IF EXISTS `method`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `method` ( CREATE TABLE `method` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(40) COLLATE utf8_unicode_ci NOT NULL, `name` varchar(40) COLLATE utf8_unicode_ci NOT NULL,
...@@ -272,15 +148,12 @@ CREATE TABLE `method` ( ...@@ -272,15 +148,12 @@ CREATE TABLE `method` (
KEY `fk_stu_met` (`id_stu`), KEY `fk_stu_met` (`id_stu`),
CONSTRAINT `fk_stu_met` FOREIGN KEY (`id_stu`) REFERENCES `student` (`id`) CONSTRAINT `fk_stu_met` FOREIGN KEY (`id_stu`) REFERENCES `student` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Information for a method. A method is composed by a set of instructions'; ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Information for a method. A method is composed by a set of instructions';
/*!40101 SET character_set_client = @saved_cs_client */;
-- --
-- Table structure for table `picto` -- Table structure for table `picto`
-- --
DROP TABLE IF EXISTS `picto`; DROP TABLE IF EXISTS `picto`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `picto` ( CREATE TABLE `picto` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`uri` varchar(250) COLLATE utf8_unicode_ci NOT NULL, `uri` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
...@@ -291,15 +164,12 @@ CREATE TABLE `picto` ( ...@@ -291,15 +164,12 @@ CREATE TABLE `picto` (
UNIQUE KEY `ck_pic` (`id_owner`,`id_src`,`uri`), UNIQUE KEY `ck_pic` (`id_owner`,`id_src`,`uri`),
KEY `fk_sou_pic` (`id_src`) KEY `fk_sou_pic` (`id_src`)
) ENGINE=InnoDB AUTO_INCREMENT=130774 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Main information about a pictogram, either coming from a source like Symbolstix or added by a supervisor. It can belongs to a category (id_cat)'; ) ENGINE=InnoDB AUTO_INCREMENT=130774 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Main information about a pictogram, either coming from a source like Symbolstix or added by a supervisor. It can belongs to a category (id_cat)';
/*!40101 SET character_set_client = @saved_cs_client */;
-- --
-- Table structure for table `picto_acl` -- Table structure for table `picto_acl`
-- --
DROP TABLE IF EXISTS `picto_acl`; DROP TABLE IF EXISTS `picto_acl`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `picto_acl` ( CREATE TABLE `picto_acl` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`id_sup` int(11) NOT NULL DEFAULT '0', `id_sup` int(11) NOT NULL DEFAULT '0',
...@@ -312,15 +182,12 @@ CREATE TABLE `picto_acl` ( ...@@ -312,15 +182,12 @@ CREATE TABLE `picto_acl` (
CONSTRAINT `fk_pic_aclp` FOREIGN KEY (`id_pic`) REFERENCES `picto` (`id`), CONSTRAINT `fk_pic_aclp` FOREIGN KEY (`id_pic`) REFERENCES `picto` (`id`),
CONSTRAINT `fk_sup_aclp` FOREIGN KEY (`id_sup`) REFERENCES `supervisor` (`id`) CONSTRAINT `fk_sup_aclp` FOREIGN KEY (`id_sup`) REFERENCES `supervisor` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Stablish access rights to pictos'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Stablish access rights to pictos';
/*!40101 SET character_set_client = @saved_cs_client */;
-- --
-- Table structure for table `picto_core` -- Table structure for table `picto_core`
-- --
DROP TABLE IF EXISTS `picto_core`; DROP TABLE IF EXISTS `picto_core`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `picto_core` ( CREATE TABLE `picto_core` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`id_pic` int(11) DEFAULT NULL COMMENT 'This is the id of the pictogram', `id_pic` int(11) DEFAULT NULL COMMENT 'This is the id of the pictogram',
...@@ -334,15 +201,12 @@ CREATE TABLE `picto_core` ( ...@@ -334,15 +201,12 @@ CREATE TABLE `picto_core` (
CONSTRAINT `picto_core_ibfk_1` FOREIGN KEY (`id_cat_pic`) REFERENCES `picto` (`id`), CONSTRAINT `picto_core_ibfk_1` FOREIGN KEY (`id_cat_pic`) REFERENCES `picto` (`id`),
CONSTRAINT `picto_core_ibfk_2` FOREIGN KEY (`id_pic`) REFERENCES `picto` (`id`) CONSTRAINT `picto_core_ibfk_2` FOREIGN KEY (`id_pic`) REFERENCES `picto` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=233 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Default pictos and categories available for a newly created student with default coordinates'; ) ENGINE=InnoDB AUTO_INCREMENT=233 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Default pictos and categories available for a newly created student with default coordinates';
/*!40101 SET character_set_client = @saved_cs_client */;
-- --
-- Table structure for table `picto_exp` -- Table structure for table `picto_exp`
-- --
DROP TABLE IF EXISTS `picto_exp`; DROP TABLE IF EXISTS `picto_exp`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `picto_exp` ( CREATE TABLE `picto_exp` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`id_pic` int(11) NOT NULL, `id_pic` int(11) NOT NULL,
...@@ -351,15 +215,12 @@ CREATE TABLE `picto_exp` ( ...@@ -351,15 +215,12 @@ CREATE TABLE `picto_exp` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `id_pic` (`id_pic`) KEY `id_pic` (`id_pic`)
) ENGINE=InnoDB AUTO_INCREMENT=270859 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Expression (text label) for a picto (or a category) in different languages. This is used by the TTS engine'; ) ENGINE=InnoDB AUTO_INCREMENT=270859 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Expression (text label) for a picto (or a category) in different languages. This is used by the TTS engine';
/*!40101 SET character_set_client = @saved_cs_client */;
-- --
-- Table structure for table `picto_tag` -- Table structure for table `picto_tag`
-- --
DROP TABLE IF EXISTS `picto_tag`; DROP TABLE IF EXISTS `picto_tag`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `picto_tag` ( CREATE TABLE `picto_tag` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`id_sup` int(11) DEFAULT NULL COMMENT 'If NULL then is a default tag', `id_sup` int(11) DEFAULT NULL COMMENT 'If NULL then is a default tag',
...@@ -373,44 +234,35 @@ CREATE TABLE `picto_tag` ( ...@@ -373,44 +234,35 @@ CREATE TABLE `picto_tag` (
CONSTRAINT `picto_tag_ibfk_1` FOREIGN KEY (`id_sup`) REFERENCES `supervisor` (`id`), CONSTRAINT `picto_tag_ibfk_1` FOREIGN KEY (`id_sup`) REFERENCES `supervisor` (`id`),
CONSTRAINT `picto_tag_ibfk_2` FOREIGN KEY (`id_pic`) REFERENCES `picto` (`id`) CONSTRAINT `picto_tag_ibfk_2` FOREIGN KEY (`id_pic`) REFERENCES `picto` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=37052 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Labels assigned to pictos by default or by supervisors'; ) ENGINE=InnoDB AUTO_INCREMENT=37052 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Labels assigned to pictos by default or by supervisors';
/*!40101 SET character_set_client = @saved_cs_client */;
-- --
-- Table structure for table `pictocat` -- Table structure for table `pictocat`
-- --
DROP TABLE IF EXISTS `pictocat`; DROP TABLE IF EXISTS `pictocat`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pictocat` ( CREATE TABLE `pictocat` (
`id` int(11) NOT NULL, `id` int(11) NOT NULL,
`id_supercat` int(11) DEFAULT NULL, `id_supercat` int(11) DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Identifies a category, which, itself, may belong to another category'; ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Identifies a category, which, itself, may belong to another category';
/*!40101 SET character_set_client = @saved_cs_client */;
-- --
-- Table structure for table `pictocattree` -- Table structure for table `pictocattree`
-- --
DROP TABLE IF EXISTS `pictocattree`; DROP TABLE IF EXISTS `pictocattree`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pictocattree` ( CREATE TABLE `pictocattree` (
`id_cat` int(11) NOT NULL, `id_cat` int(11) NOT NULL,
`id_ancestor` int(11) NOT NULL, `id_ancestor` int(11) NOT NULL,
PRIMARY KEY (`id_cat`,`id_ancestor`), PRIMARY KEY (`id_cat`,`id_ancestor`),
KEY `id_ancestor` (`id_ancestor`) KEY `id_ancestor` (`id_ancestor`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
-- --
-- Table structure for table `scene` -- Table structure for table `scene`
-- --
DROP TABLE IF EXISTS `scene`; DROP TABLE IF EXISTS `scene`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `scene` ( CREATE TABLE `scene` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
...@@ -424,30 +276,24 @@ CREATE TABLE `scene` ( ...@@ -424,30 +276,24 @@ CREATE TABLE `scene` (
CONSTRAINT `scene_ibfk_1` FOREIGN KEY (`id_sup`) REFERENCES `supervisor` (`id`), CONSTRAINT `scene_ibfk_1` FOREIGN KEY (`id_sup`) REFERENCES `supervisor` (`id`),
CONSTRAINT `scene_ibfk_2` FOREIGN KEY (`id_stu`) REFERENCES `student` (`id`) CONSTRAINT `scene_ibfk_2` FOREIGN KEY (`id_stu`) REFERENCES `student` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=161 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Scene table information. Every scene is related to some stu_pictos'; ) ENGINE=InnoDB AUTO_INCREMENT=161 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Scene table information. Every scene is related to some stu_pictos';
/*!40101 SET character_set_client = @saved_cs_client */;
-- --
-- Table structure for table `source` -- Table structure for table `source`
-- --
DROP TABLE IF EXISTS `source`; DROP TABLE IF EXISTS `source`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `source` ( CREATE TABLE `source` (
`id` tinyint(4) NOT NULL AUTO_INCREMENT, `id` tinyint(4) NOT NULL AUTO_INCREMENT,
`name` varchar(40) COLLATE utf8_unicode_ci NOT NULL, `name` varchar(40) COLLATE utf8_unicode_ci NOT NULL,
`description` varchar(4096) COLLATE utf8_unicode_ci DEFAULT NULL, `description` varchar(4096) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Contains all possible sources of pictos'; ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Contains all possible sources of pictos';
/*!40101 SET character_set_client = @saved_cs_client */;
-- --
-- Table structure for table `stu_opentry` -- Table structure for table `stu_opentry`
-- --
DROP TABLE IF EXISTS `stu_opentry`; DROP TABLE IF EXISTS `stu_opentry`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `stu_opentry` ( CREATE TABLE `stu_opentry` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`id_stu` int(11) NOT NULL, `id_stu` int(11) NOT NULL,
...@@ -466,15 +312,12 @@ CREATE TABLE `stu_opentry` ( ...@@ -466,15 +312,12 @@ CREATE TABLE `stu_opentry` (
CONSTRAINT `stu_opentry_ibfk_2` FOREIGN KEY (`id_opentry`) REFERENCES `try` (`id`) ON DELETE SET NULL, CONSTRAINT `stu_opentry_ibfk_2` FOREIGN KEY (`id_opentry`) REFERENCES `try` (`id`) ON DELETE SET NULL,
CONSTRAINT `stu_opentry_ibfk_3` FOREIGN KEY (`id_ws`) REFERENCES `working_session` (`id`) ON DELETE CASCADE CONSTRAINT `stu_opentry_ibfk_3` FOREIGN KEY (`id_ws`) REFERENCES `working_session` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
-- --
-- Table structure for table `stu_picto` -- Table structure for table `stu_picto`
-- --
DROP TABLE IF EXISTS `stu_picto`; DROP TABLE IF EXISTS `stu_picto`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `stu_picto` ( CREATE TABLE `stu_picto` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`id_stu` int(11) NOT NULL, `id_stu` int(11) NOT NULL,
...@@ -489,15 +332,12 @@ CREATE TABLE `stu_picto` ( ...@@ -489,15 +332,12 @@ CREATE TABLE `stu_picto` (
CONSTRAINT `stu_picto_ibfk_1` FOREIGN KEY (`id_stu`) REFERENCES `student` (`id`), CONSTRAINT `stu_picto_ibfk_1` FOREIGN KEY (`id_stu`) REFERENCES `student` (`id`),
CONSTRAINT `stu_picto_scene_fk` FOREIGN KEY (`id_scene`) REFERENCES `scene` (`id`) ON DELETE CASCADE CONSTRAINT `stu_picto_scene_fk` FOREIGN KEY (`id_scene`) REFERENCES `scene` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=7010 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='This table relates a student with the pictos in her vocabulary'; ) ENGINE=InnoDB AUTO_INCREMENT=7010 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='This table relates a student with the pictos in her vocabulary';
/*!40101 SET character_set_client = @saved_cs_client */;
-- --
-- Table structure for table `stu_sup` -- Table structure for table `stu_sup`
-- --
DROP TABLE IF EXISTS `stu_sup`; DROP TABLE IF EXISTS `stu_sup`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `stu_sup` ( CREATE TABLE `stu_sup` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`id_stu` int(11) NOT NULL, `id_stu` int(11) NOT NULL,
...@@ -509,15 +349,12 @@ CREATE TABLE `stu_sup` ( ...@@ -509,15 +349,12 @@ CREATE TABLE `stu_sup` (
CONSTRAINT `stu_sup_ibfk_1` FOREIGN KEY (`id_stu`) REFERENCES `student` (`id`) ON DELETE CASCADE, CONSTRAINT `stu_sup_ibfk_1` FOREIGN KEY (`id_stu`) REFERENCES `student` (`id`) ON DELETE CASCADE,
CONSTRAINT `stu_sup_ibfk_2` FOREIGN KEY (`id_sup`) REFERENCES `supervisor` (`id`) CONSTRAINT `stu_sup_ibfk_2` FOREIGN KEY (`id_sup`) REFERENCES `supervisor` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=92 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='This table relates students and supervisors'; ) ENGINE=InnoDB AUTO_INCREMENT=92 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='This table relates students and supervisors';
/*!40101 SET character_set_client = @saved_cs_client */;
-- --
-- Table structure for table `student` -- Table structure for table `student`
-- --
DROP TABLE IF EXISTS `student`; DROP TABLE IF EXISTS `student`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `student` ( CREATE TABLE `student` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(40) COLLATE utf8_unicode_ci NOT NULL, `username` varchar(40) COLLATE utf8_unicode_ci NOT NULL,
...@@ -537,80 +374,12 @@ CREATE TABLE `student` ( ...@@ -537,80 +374,12 @@ CREATE TABLE `student` (
KEY `fk_active_scene` (`id_active_scene`), KEY `fk_active_scene` (`id_active_scene`),
CONSTRAINT `fk_active_scene` FOREIGN KEY (`id_active_scene`) REFERENCES `scene` (`id`) CONSTRAINT `fk_active_scene` FOREIGN KEY (`id_active_scene`) REFERENCES `scene` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Students information'; ) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Students information';
/*!40101 SET character_set_client = @saved_cs_client */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER TRG_NEW_STUDENT_UPDATE_ENROLMENTS
AFTER INSERT ON student
FOR EACH ROW
thisTrigger: BEGIN
DECLARE LID INT;
IF ((@TRIGGER_CHECKS = FALSE)
OR (@TRIGGER_AFTER_INSERT_CHECKS = FALSE))
AND (USER() = 'root@localhost')
THEN
LEAVE thisTrigger;
END IF;
INSERT INTO scene (id_stu,id_sup,name,categories) VALUES (NEW.id, null, 'with_categories', TRUE);
SET LID = LAST_INSERT_ID();
CALL scene_create_core(LID,new.id);
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER TRG_DELETE_STUDENT_ENROLMENTS
AFTER DELETE ON student
FOR EACH ROW
thisTrigger: BEGIN
IF ((@TRIGGER_CHECKS = FALSE)
OR (@TRIGGER_AFTER_DELETE_CHECKS = FALSE))
AND (USER() = 'root@localhost')
THEN
LEAVE thisTrigger;
END IF;
IF old.id_off IS NULL THEN
UPDATE
office
SET
current_students=current_students-1
WHERE
office.id=old.id_off;
END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
-- --
-- Table structure for table `sup_off` -- Table structure for table `sup_off`
-- --
DROP TABLE IF EXISTS `sup_off`; DROP TABLE IF EXISTS `sup_off`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `sup_off` ( CREATE TABLE `sup_off` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`id_sup` int(11) NOT NULL, `id_sup` int(11) NOT NULL,
...@@ -622,7 +391,6 @@ CREATE TABLE `sup_off` ( ...@@ -622,7 +391,6 @@ CREATE TABLE `sup_off` (
CONSTRAINT `fk_off_sup` FOREIGN KEY (`id_off`) REFERENCES `supervisor` (`id`), CONSTRAINT `fk_off_sup` FOREIGN KEY (`id_off`) REFERENCES `supervisor` (`id`),
CONSTRAINT `fk_sup_off` FOREIGN KEY (`id_sup`) REFERENCES `supervisor` (`id`) CONSTRAINT `fk_sup_off` FOREIGN KEY (`id_sup`) REFERENCES `supervisor` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-- --
-- Table structure for table `supervisor` -- Table structure for table `supervisor`
...@@ -651,15 +419,12 @@ CREATE TABLE `supervisor` ( ...@@ -651,15 +419,12 @@ CREATE TABLE `supervisor` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`) UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=84 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Supervisors information'; ) ENGINE=InnoDB AUTO_INCREMENT=84 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Supervisors information';
/*!40101 SET character_set_client = @saved_cs_client */;
-- --
-- Table structure for table `try` -- Table structure for table `try`
-- --
DROP TABLE IF EXISTS `try`; DROP TABLE IF EXISTS `try`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `try` ( CREATE TABLE `try` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`id_ws` int(11) NOT NULL, `id_ws` int(11) NOT NULL,
...@@ -672,159 +437,12 @@ CREATE TABLE `try` ( ...@@ -672,159 +437,12 @@ CREATE TABLE `try` (
KEY `ix_try_begin` (`begin`), KEY `ix_try_begin` (`begin`),
CONSTRAINT `try_ibfk_1` FOREIGN KEY (`id_ws`) REFERENCES `working_session` (`id`) ON DELETE CASCADE CONSTRAINT `try_ibfk_1` FOREIGN KEY (`id_ws`) REFERENCES `working_session` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=61 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='This table contains tries information (they belong to a working session)'; ) ENGINE=InnoDB AUTO_INCREMENT=61 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='This table contains tries information (they belong to a working session)';
/*!40101 SET character_set_client = @saved_cs_client */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER TRG_NEW_TRY
AFTER INSERT ON try
FOR EACH ROW
thisTrigger: BEGIN
DECLARE idstu INT;
DECLARE idsup INT;
IF ((@TRIGGER_CHECKS = FALSE)
OR (@TRIGGER_AFTER_INSERT_CHECKS = FALSE))
AND (USER() = 'root@localhost')
THEN
LEAVE thisTrigger;
END IF;
SELECT DISTINCT M.id_stu,W.id_sup INTO idstu, idsup
FROM
instruction I,
method M,
working_session W
WHERE
NEW.id_ws=W.id AND
W.id_ins=I.id AND
I.id_met=M.id;
INSERT INTO stu_opentry(id_stu,id_sup,id_ws,id_opentry, total_tries,begin)
VALUES (
idstu,
idsup,
NEW.id_ws,
NEW.id,
0,
NOW(3)
)
ON DUPLICATE KEY UPDATE id_stu=idstu, id_sup=idsup, id_ws=NEW.id_ws, id_opentry=NEW.id;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER TRG_TRY_EVALUATED
AFTER UPDATE ON try
FOR EACH ROW
thisTrigger: BEGIN
DECLARE idws INT;
DECLARE ws_end DATE;
DECLARE ws_old_end DATE;
IF ((@TRIGGER_CHECKS = FALSE)
OR (@TRIGGER_AFTER_UPDATE_CHECKS = FALSE))
AND (USER() = 'root@localhost')
THEN
LEAVE thisTrigger;
END IF;
SELECT end INTO ws_end
FROM
stu_opentry
WHERE
id_ws = NEW.id_ws;
IF ( (old.result IS NULL) and (new.result IS NOT NULL) and (new.end>ws_end)) THEN
UPDATE stu_opentry
SET
end = new.end,
total_tries = total_tries + 1
WHERE
id_ws = NEW.id_ws;
END IF;
SELECT end INTO ws_old_end
FROM
working_session
WHERE
id = NEW.id_ws;
IF (ws_old_end < NEW.end) THEN
UPDATE working_session
SET end = NEW.end
WHERE id = NEW.id_ws;
END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
--
-- Temporary view structure for view `v_stu_last_instruction`
--
DROP TABLE IF EXISTS `v_stu_last_instruction`;
/*!50001 DROP VIEW IF EXISTS `v_stu_last_instruction`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `v_stu_last_instruction` AS SELECT
1 AS `id_ws`,
1 AS `ws_begin`,
1 AS `ws_end`,
1 AS `ws_description`,
1 AS `ins_name`,
1 AS `met_name`,
1 AS `id_stu`*/;
SET character_set_client = @saved_cs_client;
--
-- Temporary view structure for view `v_stu_last_ws_time`
--
DROP TABLE IF EXISTS `v_stu_last_ws_time`;
/*!50001 DROP VIEW IF EXISTS `v_stu_last_ws_time`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `v_stu_last_ws_time` AS SELECT
1 AS `id_stu`,
1 AS `time`*/;
SET character_set_client = @saved_cs_client;
-- --
-- Table structure for table `working_session` -- Table structure for table `working_session`
-- --
DROP TABLE IF EXISTS `working_session`; DROP TABLE IF EXISTS `working_session`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `working_session` ( CREATE TABLE `working_session` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`id_sup` int(11) NOT NULL, `id_sup` int(11) NOT NULL,
...@@ -841,180 +459,50 @@ CREATE TABLE `working_session` ( ...@@ -841,180 +459,50 @@ CREATE TABLE `working_session` (
CONSTRAINT `fk_ins_ws` FOREIGN KEY (`id_ins`) REFERENCES `instruction` (`id`), CONSTRAINT `fk_ins_ws` FOREIGN KEY (`id_ins`) REFERENCES `instruction` (`id`),
CONSTRAINT `working_session_ibfk_1` FOREIGN KEY (`id_sup`) REFERENCES `supervisor` (`id`) CONSTRAINT `working_session_ibfk_1` FOREIGN KEY (`id_sup`) REFERENCES `supervisor` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='This table stores working session information. Every working session is related to one instruction and one supervisor (and the instruction is related to one method which is related to one student)'; ) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='This table stores working session information. Every working session is related to one instruction and one supervisor (and the instruction is related to one method which is related to one student)';
/*!40101 SET character_set_client = @saved_cs_client */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ; --
/*!50003 SET @saved_cs_results = @@character_set_results */ ; -- Temporary view structure for view `v_stu_last_ws_time`
/*!50003 SET @saved_col_connection = @@collation_connection */ ; --
/*!50003 SET character_set_client = utf8 */ ; DROP TABLE IF EXISTS `v_stu_last_ws_time`;
/*!50003 SET character_set_results = utf8 */ ; CREATE ALGORITHM=UNDEFINED
/*!50003 SET collation_connection = utf8_general_ci */ ; VIEW `v_stu_last_ws_time` AS
/*!50003 SET @saved_sql_mode = @@sql_mode */ ; SELECT M.`id_stu` AS id_stu,
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; MAX(WS.begin) AS time
DELIMITER ;; FROM
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER TRG_SESSION_NEW `working_session` AS WS join
AFTER INSERT ON working_session `instruction` AS I join
FOR EACH ROW `method` AS M
thisTrigger: BEGIN WHERE
DECLARE idstu INT; WS.`id_ins` =I.`id`
DECLARE ins_begin DATE; and I.`id_met` = M.`id`
group by M.`id_stu`;
IF ((@TRIGGER_CHECKS = FALSE)
OR (@TRIGGER_AFTER_INSERT_CHECKS = FALSE)) --
AND (USER() = 'root@localhost') -- Temporary view structure for view `v_stu_last_instruction`
THEN --
LEAVE thisTrigger; DROP TABLE IF EXISTS `v_stu_last_instruction`;
END IF; CREATE ALGORITHM=UNDEFINED
VIEW `v_stu_last_instruction` AS
SELECT begin INTO ins_begin select
FROM instruction WS.`id` AS `id_ws`,
WHERE id = NEW.id_ins; WS.`begin` AS `ws_begin`,
WS.`end` AS `ws_end`,
IF (ins_begin IS NULL) THEN WS.`description` AS `ws_description`,
UPDATE instruction I.`name` AS `ins_name`,
SET M.`name` AS `met_name`,
begin = NOW(3), M.`id_stu` AS `id_stu`
end = NOW(3) FROM
WHERE `working_session` AS WS join
id = NEW.id_ins; `instruction` AS I join
END IF; `method` AS M join
`v_stu_last_ws_time` AS LAST_WS
UPDATE instruction WHERE
SET LAST_WS.time = WS.begin and
status='started', LAST_WS.id_stu = M.`id_stu` and
end = NOW(3) WS.`id_ins` =I.`id`
WHERE and I.`id_met` = M.`id`;
id = NEW.id_ins;
INSERT INTO try(`id_ws`) /*
VALUES (new.id); END OF SCHEMA FOR PICTODB
END */;; */
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER TRG_SESSION_CLOSING
BEFORE UPDATE ON working_session
FOR EACH ROW
thisTrigger: BEGIN
IF ((@TRIGGER_CHECKS = FALSE)
OR (@TRIGGER_BEFORE_UPDATE_CHECKS = FALSE))
AND (USER() = 'root@localhost')
THEN
LEAVE thisTrigger;
END IF;
IF ((new.end IS NOT NULL) AND (new.current IS NOT NULL)) THEN
SET new.current=NULL;
DELETE FROM stu_opentry
WHERE id_ws = new.id;
DELETE FROM `try`
WHERE
end = NULL AND
id_ws = new.id;
END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER TRG_SESSION_CLOSED
AFTER UPDATE ON working_session
FOR EACH ROW
thisTrigger: BEGIN
IF ((@TRIGGER_CHECKS = FALSE)
OR (@TRIGGER_AFTER_UPDATE_CHECKS = FALSE))
AND (USER() = 'root@localhost')
THEN
LEAVE thisTrigger;
END IF;
IF (OLD.end < NEW.end) THEN
UPDATE instruction
SET
end = NEW.end
WHERE
id = NEW.id_ins;
END IF;
IF ((old.end IS NULL) and (new.end IS NOT NULL)) THEN
CALL deleteOpenTry(new.id);
END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
--
-- Final view structure for view `v_stu_last_instruction`
--
/*!50001 DROP VIEW IF EXISTS `v_stu_last_instruction`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = utf8 */;
/*!50001 SET character_set_results = utf8 */;
/*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v_stu_last_instruction` AS select `WS`.`id` AS `id_ws`,`WS`.`begin` AS `ws_begin`,`WS`.`end` AS `ws_end`,`WS`.`description` AS `ws_description`,`I`.`name` AS `ins_name`,`M`.`name` AS `met_name`,`M`.`id_stu` AS `id_stu` from (((`working_session` `WS` join `instruction` `I`) join `method` `M`) join `v_stu_last_ws_time` `LAST_WS`) where ((`LAST_WS`.`time` = `WS`.`begin`) and (`LAST_WS`.`id_stu` = `M`.`id_stu`) and (`WS`.`id_ins` = `I`.`id`) and (`I`.`id_met` = `M`.`id`)) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
--
-- Final view structure for view `v_stu_last_ws_time`
--
/*!50001 DROP VIEW IF EXISTS `v_stu_last_ws_time`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = utf8 */;
/*!50001 SET character_set_results = utf8 */;
/*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v_stu_last_ws_time` AS select `M`.`id_stu` AS `id_stu`,max(`WS`.`begin`) AS `time` from ((`working_session` `WS` join `instruction` `I`) join `method` `M`) where ((`WS`.`id_ins` = `I`.`id`) and (`I`.`id_met` = `M`.`id`)) group by `M`.`id_stu` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
/*!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 2017-08-10 11:20:52
...@@ -6,10 +6,21 @@ SET @TRIGGER_CHECKS = FALSE; ...@@ -6,10 +6,21 @@ SET @TRIGGER_CHECKS = FALSE;
-- --
-- Dumping data for table `supervisor` -- Dumping data for table `supervisor`
-- --
LOCK TABLES `supervisor` WRITE; LOCK TABLES `supervisor` WRITE;
/*!40000 ALTER TABLE `supervisor` DISABLE KEYS */; /*!40000 ALTER TABLE `supervisor` DISABLE KEYS */;
INSERT INTO `supervisor` VALUES (-1,'none','none','M','defaultAvatar.jpg',NULL,'',NULL,'',NULL,'es-es',NULL,'',0,0,'tutor'),(23,'Comunicación Aumentativa JAén (CAJA)','','M','test_caja_dofer.jpg',NULL,'23071',NULL,'dofer@ujaen.es','+34953212888','es-es',NULL,'$2a$10$Q4jHNlC58.ptfl/5wZeHfOIvpJslJHKOFNZO3bWs4it7TifQPQnEa',1,0,'office'),(24,'Miguel Ángel','García Cumbreras','M','test_caja_miguel.jpg',NULL,'23071',NULL,'magc@ujaen.es','+34953212420','es-es',NULL,'$2a$04$XQvWUwGTvjR47ChPwd3f6ukx8Zg.7o1N4Kf6P.zqhVtQxVNArOsXi',1,0,'therapist'),(25,'Arturo','Montejo Ráez','M','test_caja_arturo.jpg',NULL,'23071',NULL,'amontejo@ujaen.es','+34953212882','es-es',NULL,'$2a$04$yoBXAMSgCVGSIr2pnuIOw.J8UCm8f2XkATu5rqsMJiEmlxBHs5.cO',1,0,'therapist'),(26,'Alfonso','Ureña López','M','test_caja_alfonso.jpg',NULL,'23071',NULL,'laurena@ujaen.es','+34953212895','es-es',NULL,'$2a$04$zVGHJFafoZa60wo1yBqF/Oi3RXV/qS2cq0/j/W3Dkf4P1ad0e7.iS',1,0,'therapist'),(27,'Jesús','Navarro Moreno','M','defaultAvatar.jpg',NULL,'23071',NULL,'jnavarro@ujaen.es','+34953211912','es-es',NULL,'$2a$04$8O3Jd5j9/nM/KC.b1a8qRevyUwWUx6XGU3Gm754Y/8PpLO2jv.i76',1,0,'therapist'),(28,'Don Fernando','Padre Fernandito','M','defaultAvatar.jpg','C/ Mayor, 13. Jaén','23071','ES','donfernando@gmail.com','+34 232 232 232','es-es',NULL,'$2a$04$DMOX/cZ4h6cNJW9VlCou7O266q4YDYuS6p0QzP.gBHd08.QnFQWD.',1,0,'tutor'),(29,'Don Arturo','Padre Arturito','M','defaultAvatar.jpg','Avda. Andalucía 1. Jaén','23071','ES','donarturo@gmail.com',NULL,'es-es',NULL,'$2a$04$V2ods9MMmOFvdLTaHJqk3ejKEYdf28gvfDhaBkOSLCFJOC02TweFK',1,0,'tutor'),(30,'Don Miguel','Padre Miguelito','F','defaultAvatar.jpg','C/ Calatrava, 13. Córdoba','23071','ES','donmiguel@gmail.com',NULL,'es-es',NULL,'$2a$04$1UCak614LKz6WpDBtOblQeqFF41tOMy6ERMnP2OuGVZffe8Yi0mJq',1,0,'tutor'),(31,'Don Alfonso','Padre Alfonsito','M','defaultAvatar.jpg','Avda. Andalucía 1. Jaén','23071','ES','donalfonso@gmail.com',NULL,'es-es',NULL,'$2a$06$UtyBV4tLlT7xSqIt8LKPBucGvZ.Wgf7RgGE0fRcjEBDwjxjHlsP3K',1,0,'tutor'),(32,'Doña Alfonsa','Madre Alfonsita','F','defaultAvatar.jpg','C/ Calatrava, 13. Córdoba','23071','ES','doñaalfonsa@gmail.com',NULL,'es-es',NULL,'$2a$04$ALDmQ1oRhRZKUEi1b0eK1ehQmSZiFkhzx48ZBwER0J4vakvlYc5VS',1,0,'tutor'),(33,'Don Jesús','Padre Jesusito','M','defaultAvatar.jpg','Avda. Andalucía 1. Jaén','23071','ES','donjesus@gmail.com',NULL,'es-es',NULL,'$2a$04$Psuu6IMPUj1sbzR.uxq3EOgX1/4dFNmccjkv76LhKp35JzpiCE.fm',1,0,'tutor'); INSERT INTO `supervisor` (`id`, `name`, `surname`, `gender`, `pic`, `address`, `postal_code`, `country`, `email`, `phone`, `lang`, `tts_engine`, `password`, `active`, `arasaac_license`, `role`) VALUES
(23,'Comunicación Aumentativa JAén (CAJA)', '', 'M', 'test_caja_dofer.jpg' ,NULL, '23071', NULL, 'dofer@ujaen.es', '+34953212888','es-es',NULL,'$2a$10$Q4jHNlC58.ptfl/5wZeHfOIvpJslJHKOFNZO3bWs4it7TifQPQnEa',1,0,'office'),
(24,'Miguel Ángel','García Cumbreras', 'M', 'test_caja_miguel.jpg', NULL, '23071', NULL, 'magc@ujaen.es', '+34953212420','es-es',NULL,'$2a$04$XQvWUwGTvjR47ChPwd3f6ukx8Zg.7o1N4Kf6P.zqhVtQxVNArOsXi',1,0,'therapist'),
(25,'Arturo','Montejo Ráez', 'M', 'test_caja_arturo.jpg', NULL, '23071', NULL,' amontejo@ujaen.es', '+34953212882','es-es',NULL,'$2a$04$yoBXAMSgCVGSIr2pnuIOw.J8UCm8f2XkATu5rqsMJiEmlxBHs5.cO',1,0,'therapist'),
(26,'Alfonso','Ureña López', 'M', 'test_caja_alfonso.jpg', NULL, '23071', NULL, 'laurena@ujaen.es', '+34953212895','es-es',NULL,'$2a$04$zVGHJFafoZa60wo1yBqF/Oi3RXV/qS2cq0/j/W3Dkf4P1ad0e7.iS',1,0,'therapist'),
(27,'Jesús','Navarro Moreno', 'M', 'defaultAvatar.jpg', NULL, '23071', NULL, 'jnavarro@ujaen.es', '+34953211912','es-es',NULL,'$2a$04$8O3Jd5j9/nM/KC.b1a8qRevyUwWUx6XGU3Gm754Y/8PpLO2jv.i76',1,0,'therapist'),
(28,'Don Fernando','Padre Fernandito','M','defaultAvatar.jpg','C/ Mayor, 13. Jaén','23071','ES','donfernando@gmail.com',
'+34 232 232 232','es-es',NULL,'$2a$04$DMOX/cZ4h6cNJW9VlCou7O266q4YDYuS6p0QzP.gBHd08.QnFQWD.',1,0,'tutor'),
(29,'Don Arturo','Padre Arturito','M','defaultAvatar.jpg','Avda. Andalucía 1. Jaén','23071','ES','donarturo@gmail.com', NULL,'es-es',NULL,'$2a$04$V2ods9MMmOFvdLTaHJqk3ejKEYdf28gvfDhaBkOSLCFJOC02TweFK',1,0,'tutor'),
(30,'Don Miguel','Padre Miguelito','F','defaultAvatar.jpg','C/ Calatrava, 13. Córdoba','23071','ES','donmiguel@gmail.com', NULL,'es-es',NULL,'$2a$04$1UCak614LKz6WpDBtOblQeqFF41tOMy6ERMnP2OuGVZffe8Yi0mJq',1,0,'tutor'),
(31,'Don Alfonso','Padre Alfonsito','M','defaultAvatar.jpg','Avda. Andalucía 1. Jaén','23071','ES','donalfonso@gmail.com', NULL,'es-es',NULL,'$2a$06$UtyBV4tLlT7xSqIt8LKPBucGvZ.Wgf7RgGE0fRcjEBDwjxjHlsP3K',1,0,'tutor'),
(32,'Doña Alfonsa','Madre Alfonsita','F','defaultAvatar.jpg','C/ Calatrava, 13. Córdoba','23071','ES','doñaalfonsa@gmail.com', NULL,'es-es',NULL,'$2a$04$ALDmQ1oRhRZKUEi1b0eK1ehQmSZiFkhzx48ZBwER0J4vakvlYc5VS',1,0,'tutor'),
(33,'Don Jesús','Padre Jesusito','M','defaultAvatar.jpg','Avda. Andalucía 1. Jaén','23071','ES','donjesus@gmail.com', NULL,'es-es',NULL,'$2a$04$Psuu6IMPUj1sbzR.uxq3EOgX1/4dFNmccjkv76LhKp35JzpiCE.fm',1,0,'tutor');
/*!40000 ALTER TABLE `supervisor` ENABLE KEYS */; /*!40000 ALTER TABLE `supervisor` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
...@@ -19,7 +30,7 @@ UNLOCK TABLES; ...@@ -19,7 +30,7 @@ UNLOCK TABLES;
LOCK TABLES `sup_off` WRITE; LOCK TABLES `sup_off` WRITE;
/*!40000 ALTER TABLE `sup_off` DISABLE KEYS */; /*!40000 ALTER TABLE `sup_off` DISABLE KEYS */;
INSERT INTO `sup_off` VALUES (-1,NULL),(28,NULL),(29,NULL),(30,NULL),(31,NULL),(32,NULL),(33,NULL),(23,23),(24,23),(25,23),(26,23),(27,23); INSERT INTO `sup_off` VALUES (1, -1,NULL),(2,28,NULL),(3,29,NULL),(4,30,NULL),(5,31,NULL),(6,32,NULL),(7,33,NULL),(8,23,23),(9,24,23),(10,25,23),(11,26,23),(12,27,23);
/*!40000 ALTER TABLE `sup_off` ENABLE KEYS */; /*!40000 ALTER TABLE `sup_off` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
......
...@@ -3,40 +3,10 @@ ...@@ -3,40 +3,10 @@
DELIMITER ;; DELIMITER ;;
DROP TRIGGER IF EXISTS TRG_NEW_STUDENT_MAXENROLMENTS;;
-- Integrity rule 1: It is not possible to enrol a higer number of student than office.max_enrolments
-- NOTE this has been disabled as accounts are now controlled by licenses
DROP TRIGGER IF EXISTS TRG_NEW_STUDENT_MAXENROLMENTS;
-- CREATE TRIGGER TRG_NEW_STUDENT_MAXENROLMENTS
-- BEFORE INSERT ON student
-- FOR EACH ROW
-- thisTrigger: BEGIN
-- DECLARE max_enr,curr_enr INT;
--
-- IF ((@TRIGGER_CHECKS = FALSE)
-- OR (@TRIGGER_BEFORE_INSERT_CHECKS = FALSE))
-- AND (USER() = 'root@localhost')
-- THEN
-- LEAVE thisTrigger;
-- END IF;
--
-- IF new.id_off IS NOT NULL THEN
-- SELECT
-- max_students, current_students INTO max_enr, curr_enr
-- FROM
-- office
-- WHERE
-- office.id=new.id_off;
--
-- IF curr_enr>=max_enr THEN
-- SIGNAL SQLSTATE '45000'
-- SET MESSAGE_TEXT = 'Maximum number of enrolments reached', MYSQL_ERRNO = 1001;
-- END IF;
-- END IF;
-- END;;
-- Integrity rule 2: office.current_enrolments updating (adding core) -- Integrity rule 2: office.current_enrolments updating (adding core)
DROP TRIGGER IF EXISTS TRG_NEW_STUDENT_UPDATE_ENROLMENTS; DROP TRIGGER IF EXISTS TRG_NEW_STUDENT_UPDATE_ENROLMENTS;;
CREATE TRIGGER TRG_NEW_STUDENT_UPDATE_ENROLMENTS CREATE TRIGGER TRG_NEW_STUDENT_UPDATE_ENROLMENTS
AFTER INSERT ON student AFTER INSERT ON student
FOR EACH ROW FOR EACH ROW
...@@ -56,7 +26,7 @@ thisTrigger: BEGIN ...@@ -56,7 +26,7 @@ thisTrigger: BEGIN
END;; END;;
DROP PROCEDURE IF EXISTS active_scene_update; DROP PROCEDURE IF EXISTS active_scene_update;;
CREATE PROCEDURE active_scene_update(IN _id_stu INTEGER) CREATE PROCEDURE active_scene_update(IN _id_stu INTEGER)
BEGIN BEGIN
DECLARE _id_scene INTEGER; DECLARE _id_scene INTEGER;
...@@ -66,7 +36,7 @@ BEGIN ...@@ -66,7 +36,7 @@ BEGIN
END;; END;;
-- Procedure to add core when new scene is created -- Procedure to add core when new scene is created
DROP PROCEDURE IF EXISTS scene_create_core ; DROP PROCEDURE IF EXISTS scene_create_core;;
CREATE PROCEDURE scene_create_core(IN id_scene INTEGER, IN id_stu INTEGER) CREATE PROCEDURE scene_create_core(IN id_scene INTEGER, IN id_stu INTEGER)
BEGIN BEGIN
...@@ -83,27 +53,6 @@ CREATE PROCEDURE scene_create_core(IN id_scene INTEGER, IN id_stu INTEGER) ...@@ -83,27 +53,6 @@ CREATE PROCEDURE scene_create_core(IN id_scene INTEGER, IN id_stu INTEGER)
END;; END;;
-- Integrity rule 3: office.current_enrolments and supervisor assigments updating. -- Integrity rule 3: office.current_enrolments and supervisor assigments updating.
DROP TRIGGER IF EXISTS TRG_MODIFY_STUDENT_ENROLMENTS; DROP TRIGGER IF EXISTS TRG_MODIFY_STUDENT_ENROLMENTS;;
-- CREATE TRIGGER TRG_MODIFY_STUDENT_ENROLMENTS DELIMITER;
-- AFTER UPDATE ON student
-- FOR EACH ROW
-- thisTrigger: BEGIN
-- IF ((@TRIGGER_CHECKS = FALSE)
-- OR (@TRIGGER_AFTER_UPDATE_CHECKS = FALSE))
-- AND (USER() = 'root@localhost')
-- THEN
-- LEAVE thisTrigger;
-- END IF;
--
-- IF NOT (old.id_off<=>new.id_off) THEN
-- IF (old.id_off IS NOT NULL) THEN
-- DELETE
-- stu_sup
-- FROM
-- stu_sup INNER JOIN supervisor ON (stu_sup.id_sup=supervisor.id)
-- WHERE
-- id_stu=new.id AND old.id_off=supervisor.id_off;
-- END IF;
-- END IF;
-- END;;
...@@ -468,7 +468,7 @@ function sqlTypeCast(attr) { ...@@ -468,7 +468,7 @@ function sqlTypeCast(attr) {
break; break;
case 'datetime': case 'datetime':
expandedType = 'DATETIME(3)'; expandedType = 'DATETIME';
break; break;
case 'time': case 'time':
...@@ -499,8 +499,7 @@ function toSqlDate(date) { ...@@ -499,8 +499,7 @@ function toSqlDate(date) {
('00' + date.getDate()).slice(-2) + ' ' + ('00' + date.getDate()).slice(-2) + ' ' +
('00' + date.getHours()).slice(-2) + ':' + ('00' + date.getHours()).slice(-2) + ':' +
('00' + date.getMinutes()).slice(-2) + ':' + ('00' + date.getMinutes()).slice(-2) + ':' +
('00' + date.getSeconds()).slice(-2) + '.' + ('00' + date.getSeconds()).slice(-2);
('00' + date.getMilliseconds()).slice(-3);
return date; return date;
} }
......
...@@ -242,8 +242,7 @@ utils.toSqlDate = function toSqlDate(date) { ...@@ -242,8 +242,7 @@ utils.toSqlDate = function toSqlDate(date) {
('00' + date.getDate()).slice(-2) + ' ' + ('00' + date.getDate()).slice(-2) + ' ' +
('00' + date.getHours()).slice(-2) + ':' + ('00' + date.getHours()).slice(-2) + ':' +
('00' + date.getMinutes()).slice(-2) + ':' + ('00' + date.getMinutes()).slice(-2) + ':' +
('00' + date.getSeconds()).slice(-2) + "." + ('00' + date.getSeconds()).slice(-2);
('00' + date.getMilliseconds()).slice(-3);
return date; return date;
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment