Stu_pictos que no aparecen
En DEV, probando la adaptación de los nuevos tableros me encuentro con el siguiente problema:
Estudiante 64 tiene asignados 14 stu_pictos sobre "Escena 2" (id: 192), sin embargo sólo dispone de 12 pictogramas visibles en el tablero.
select * from stu_picto where id_stu=64
me devuelve 1171 filas, pero he contado todos los pictogramas... y me salen unos 400 en total.
Pendiente:
- Revisar otras "escenas" para sacar alguna conclusión (¿demasiados cambios sobre DEV?).
- Con este estado en la base de datos es complicado que el script de adaptación a "tableros" funcione, buscar soluciones.
-
changed the description
Toggle commit list -
Developer
Cuando se borra una escena, los stu_picto asociados no se eliminan.
-
Developer
Éste es el create table que debería estar en DEV, pero no está de ese modo.
CREATE TABLE `stu_picto` ( `id` int(11) NOT NULL AUTO_INCREMENT, `id_stu` int(11) NOT NULL, `id_pic` int(11) NOT NULL, `attributes` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'JSON object describing the properties of the picto', `id_scene` int(11) NOT NULL, `id_child_scene` int(11) NULL; PRIMARY KEY (`id`), KEY `fk_picto` (`id_pic`), KEY `id_stu` (`id_stu`), KEY `stu_picto_grid_fk` (`id_grid`), CONSTRAINT `fk_picto` FOREIGN KEY (`id_pic`) REFERENCES `picto` (`id`), CONSTRAINT `stu_picto_ibfk_1` FOREIGN KEY (`id_stu`) REFERENCES `student` (`id`), CONSTRAINT `stu_picto_grid_fk` FOREIGN KEY (`id_grid`) 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';
-
Developer
Parece que cuando se actualizó al sistema de escenas y aplicar el CHANGES.md una línea no terminó correctamente por existir referencias a dichas columnas.
`ALTER TABLE `stu_picto` ADD CONSTRAINT `stu_picto_scene_fk` FOREIGN KEY (`id_scene`) REFERENCES `scene` (`id`) ON DELETE CASCADE;`
(si hay problema al añadir la foreign key, hacer SET FOREIGN_KEY_CHECKS = 0; antes de añadirla y SET FOREIGN_KEY_CHECKS = 1; después)
-
Developer
Posible solución:
Deshabilitar comprobaciones de clave ajena:
SET FOREIGN_KEY_CHECKS = 0
Eliminación de stu_pictos que no deberían existir:
DELETE FROM `stu_picto` WHERE `id_scene` NOT IN (SELECT `s.id` FROM `scene` s);
Añadir la restricción sobre la tabla
stu_picto
:ALTER TABLE `stu_picto` ADD CONSTRAINT `stu_picto_scene_fk` FOREIGN KEY (`id_scene`) REFERENCES `scene` (`id`) ON DELETE CASCADE;
Volver a habilitar las comprobaciones de clave ajena:
SET FOREIGN_KEY_CHECKS = 1
-
closed
Toggle commit list