migration issues fixed

parent a1ce8ff1
......@@ -44,7 +44,7 @@ BEGIN
/* FIRST SCENE, ACTIVE, WITH CATEGORIES*/
INSERT INTO `scene` (name, categories, id_stu)
VALUES ('with_categories', _cat_active, _id_stu);
VALUES ('Con categorías', _cat_active, _id_stu);
SET LID = LAST_INSERT_ID();
......@@ -58,7 +58,7 @@ BEGIN
/* SECOND SCENE, NOT ACTIVE, NO CATEGORIES*/
INSERT INTO `scene` (name, categories, id_sup, id_stu)
VALUES ('no_categories', NOT _cat_active, _id_sup, _id_stu);
VALUES ('Sin categorías', NOT _cat_active, _id_sup, _id_stu);
SET LID = LAST_INSERT_ID();
......
......@@ -7,103 +7,109 @@ SET @TRIGGER_CHECKS = FALSE;
-- Oficina
--
INSERT INTO `office` (
`name`,
`address`,
`country`,
`contact_person`,
`email`,
`phone1`,
`lang`,
`postal_code`
) VALUES (
'Comunicación Aumentativa JAén (CAJA)',
'Paraje Las Lagunillas, Ed A3, primera plata, 23071. Jaén',
'ES',
'Fernando Martínez Santiago',
'dofer@ujaen.es',
'+34 953 21 28 88',
'es-es',
'23071'
);
INSERT INTO `office` (
`name`,
`address`,
`country`,
`contact_person`,
`email`,
`phone1`,
`lang`,
`postal_code`
) VALUES (
'Comunicación Aumentativa JAén (CAJA)',
'Paraje Las Lagunillas, Ed A3, primera plata, 23071. Jaén',
'ES',
'Fernando Martínez Santiago',
'dofer@ujaen.es',
'+34 953 21 28 88',
'es-es',
'23071'
);
--
-- Supervisores
--
INSERT INTO `supervisor` (
`name`,
`surname`,
`gender`,
`address`,
`email`,
`phone`,
`lang`,
`password`,
`active`,
`id_off`,
`pic`
) VALUES (
'Fernando',
'Martínez Santiago',
'M',
NULL,
'dofer@ujaen.es',
'+34953212888',
'es-es',
'$2a$10$Q4jHNlC58.ptfl/5wZeHfOIvpJslJHKOFNZO3bWs4it7TifQPQnEa',
true,
(SELECT id from office where email='dofer@ujaen.es'),
'test_caja_dofer.jpg'
), (
'Miguel Ángel',
'García Cumbreras',
'M',
NULL,
'magc@ujaen.es',
'+34953212420',
'es-es',
'$2a$04$XQvWUwGTvjR47ChPwd3f6ukx8Zg.7o1N4Kf6P.zqhVtQxVNArOsXi',
true,
(SELECT id from office where email='dofer@ujaen.es'),
'test_caja_miguel.jpg'
), (
'Arturo',
'Montejo Ráez',
'M',
NULL,
'amontejo@ujaen.es',
'+34953212882',
'es-es',
'$2a$04$yoBXAMSgCVGSIr2pnuIOw.J8UCm8f2XkATu5rqsMJiEmlxBHs5.cO',
true,
(SELECT id from office where email='dofer@ujaen.es'),
'test_caja_arturo.jpg'
), (
'Alfonso',
'Ureña López',
'M',
NULL,
'laurena@ujaen.es',
'+34953212895',
'es-es',
'$2a$04$zVGHJFafoZa60wo1yBqF/Oi3RXV/qS2cq0/j/W3Dkf4P1ad0e7.iS',
true,
(SELECT id from office where email='dofer@ujaen.es'),
'test_caja_alfonso.jpg'
), (
'Jesús',
'Navarro Moreno',
'M',
NULL,
'jnavarro@ujaen.es',
'+34953211912',
'es-es',
'$2a$04$8O3Jd5j9/nM/KC.b1a8qRevyUwWUx6XGU3Gm754Y/8PpLO2jv.i76',
true,
(SELECT id from office where email='dofer@ujaen.es'),
'defaultAvatar.jpg'
);
INSERT INTO `supervisor` (
`name`,
`surname`,
`gender`,
`address`,
`email`,
`phone`,
`lang`,
`password`,
`active`,
`postal_code`,
`id_off`,
`pic`
) VALUES (
'Fernando',
'Martínez Santiago',
'M',
NULL,
'dofer@ujaen.es',
'+34953212888',
'es-es',
'$2a$10$Q4jHNlC58.ptfl/5wZeHfOIvpJslJHKOFNZO3bWs4it7TifQPQnEa',
true,
'23071',
(SELECT id from office where email='dofer@ujaen.es'),
'test_caja_dofer.jpg'
), (
'Miguel Ángel',
'García Cumbreras',
'M',
NULL,
'magc@ujaen.es',
'+34953212420',
'es-es',
'$2a$04$XQvWUwGTvjR47ChPwd3f6ukx8Zg.7o1N4Kf6P.zqhVtQxVNArOsXi',
true,
'23071',
(SELECT id from office where email='dofer@ujaen.es'),
'test_caja_miguel.jpg'
), (
'Arturo',
'Montejo Ráez',
'M',
NULL,
'amontejo@ujaen.es',
'+34953212882',
'es-es',
'$2a$04$yoBXAMSgCVGSIr2pnuIOw.J8UCm8f2XkATu5rqsMJiEmlxBHs5.cO',
true,
'23071',
(SELECT id from office where email='dofer@ujaen.es'),
'test_caja_arturo.jpg'
), (
'Alfonso',
'Ureña López',
'M',
NULL,
'laurena@ujaen.es',
'+34953212895',
'es-es',
'$2a$04$zVGHJFafoZa60wo1yBqF/Oi3RXV/qS2cq0/j/W3Dkf4P1ad0e7.iS',
true,
'23071',
(SELECT id from office where email='dofer@ujaen.es'),
'test_caja_alfonso.jpg'
), (
'Jesús',
'Navarro Moreno',
'M',
NULL,
'jnavarro@ujaen.es',
'+34953211912',
'es-es',
'$2a$04$8O3Jd5j9/nM/KC.b1a8qRevyUwWUx6XGU3Gm754Y/8PpLO2jv.i76',
true,
'23071',
(SELECT id from office where email='dofer@ujaen.es'),
'defaultAvatar.jpg'
);
--
-- Tutores
......@@ -119,7 +125,8 @@ INSERT INTO `supervisor` (
`phone`,
`lang`,
`password`,
`active`
`active`,
`postal_code`
) VALUES (
'Don Fernando',
'Padre Fernandito',
......@@ -130,7 +137,8 @@ INSERT INTO `supervisor` (
'+34 232 232 232',
'es-es',
'$2a$04$DMOX/cZ4h6cNJW9VlCou7O266q4YDYuS6p0QzP.gBHd08.QnFQWD.',
true
true,
'23071'
), (
'Don Arturo',
'Padre Arturito',
......@@ -141,7 +149,8 @@ INSERT INTO `supervisor` (
NULL,
'es-es',
'$2a$04$V2ods9MMmOFvdLTaHJqk3ejKEYdf28gvfDhaBkOSLCFJOC02TweFK',
true
true,
'23071'
), (
'Don Miguel',
'Padre Miguelito',
......@@ -152,18 +161,20 @@ INSERT INTO `supervisor` (
NULL,
'es-es',
'$2a$04$1UCak614LKz6WpDBtOblQeqFF41tOMy6ERMnP2OuGVZffe8Yi0mJq',
true
true,
'23071'
), (
'Don Afonso',
'Don Alfonso',
'Padre Alfonsito',
'M',
'Avda. Andalucía 1. Jaén',
'ES',
'donalfonso@gmail.com',
'donalfonso@gmail.com',
NULL,
'es-es',
'$2a$04$$2a$04$KktXwe06AJg3vMUEX1E1/esbP.g8f79mtcNGjCsrEDWktmegcML4q',
true
'$2a$06$UtyBV4tLlT7xSqIt8LKPBucGvZ.Wgf7RgGE0fRcjEBDwjxjHlsP3K',
true,
'23071'
), (
'Doña Alfonsa',
'Madre Alfonsita',
......@@ -174,7 +185,8 @@ INSERT INTO `supervisor` (
NULL,
'es-es',
'$2a$04$ALDmQ1oRhRZKUEi1b0eK1ehQmSZiFkhzx48ZBwER0J4vakvlYc5VS',
true
true,
'23071'
), (
'Don Jesús',
'Padre Jesusito',
......@@ -185,7 +197,8 @@ INSERT INTO `supervisor` (
NULL,
'es-es',
'$2a$04$Psuu6IMPUj1sbzR.uxq3EOgX1/4dFNmccjkv76LhKp35JzpiCE.fm',
true
true,
'23071'
);
--
......@@ -383,42 +396,42 @@ UPDATE student SET id_off=(SELECT id_off FROM supervisor WHERE supervisor.name='
UPDATE student SET id_off=(SELECT id_off FROM supervisor WHERE supervisor.name='Jesús') WHERE student.name='Jesusito';
UPDATE student SET id_off=(SELECT id_off FROM supervisor WHERE supervisor.name='Jesús') WHERE student.name='Jesusita';
select a.name,b.attributes,text from student a, stu_picto b, picto c, picto_exp d where a.id=b.id_stu and b.id_pic=c.id and c.id=d.id_pic and a.id=23 and a.lang=d.lang;
// select a.name,b.attributes,text from student a, stu_picto b, picto c, picto_exp d where a.id=b.id_stu and b.id_pic=c.id and c.id=d.id_pic and a.id=23 and a.lang=d.lang;
--
-- CAJA Core vocabulary
--
INSERT INTO stu_picto(id_stu,id_pic,attributes)
SELECT S.id,P.id_pic, concat('{"id_cat":', if (id_cat_pic is null, 'null',id_cat_pic),
',"coord_x":',coord_x,
',"coord_y":',coord_y,
',"status":"invisible"',
',"highlight":false',
',"color":', if (color is null, 'null',concat('"',color,'"')),
'}') as attributes
FROM student S, picto_core P
WHERE S.id_off =(SELECT id from office where name='Comunicación Aumentativa JAén (CAJA)');
--
-- INSERT INTO stu_picto(id_stu,id_pic,scene,attributes)
-- SELECT S.id,P.id_pic, concat('{"id_cat":', if (id_cat_pic is null, 'null',id_cat_pic),
-- ',"coord_x":',coord_x,
-- ',"coord_y":',coord_y,
-- ',"status":"invisible"',
-- ',"highlight":false',
-- ',"color":', if (color is null, 'null',concat('"',color,'"')),
-- '}') as attributes
-- FROM student S, picto_core P
-- WHERE S.id_off =(SELECT id from office where name='Comunicación Aumentativa JAén (CAJA)');
--
-- Test method
--
INSERT INTO meta_method(name) VALUES (
'Test MetaMethod'
);
INSERT INTO method(name, id_stu) VALUES (
'Test Method',
(SELECT id FROM student WHERE username='aaa0002')
);
INSERT INTO instruction(name, id_met) VALUES (
'Test Instruction',
(SELECT id FROM method WHERE name='Test Method')
);
INSERT INTO working_session (id_sup, id_ins) VALUES (
(SELECT id FROM supervisor WHERE email='dofer@ujaen.es'),
(SELECT id FROM instruction WHERE name='Test Instruction')
);
-- INSERT INTO meta_method(name) VALUES (
-- 'Test MetaMethod'
-- );
-- INSERT INTO method(name, id_stu) VALUES (
-- 'Test Method',
-- (SELECT id FROM student WHERE username='aaa0002')
-- );
-- INSERT INTO instruction(name, id_met) VALUES (
-- 'Test Instruction',
-- (SELECT id FROM method WHERE name='Test Method')
-- );
-- INSERT INTO working_session (id_sup, id_ins) VALUES (
-- (SELECT id FROM supervisor WHERE email='dofer@ujaen.es'),
-- (SELECT id FROM instruction WHERE name='Test Instruction')
-- );
SET @TRIGGER_CHECKS = TRUE;
SET foreign_key_checks=1;
......@@ -4,20 +4,7 @@ Changes to be performed manually in servers to upgrade
## Database
- Reload triggers-session-constraints.sql
- Delete active column from scene table (deleted from `already done in dev` sql `create scene table` statement)
`alter table scene drop active;`
- Add id_active_scene to student table
`ALTER TABLE student ADD COLUMN id_active_scene INT(11) DEFAULT NULL;`
`ALTER TABLE student ADD CONSTRAINT fk_active_scene FOREIGN KEY (`id_active_scene`) REFERENCES scene (`id`);`
- Reload enrolments trigger
`source /vagrant/roles/database/files/triggers-enrolments-integrity-constraints.sql;`
(already done in dev)
Already done in dev:
- update arasaac uri
`source update_arasaac_color_uri.sql`
......@@ -38,6 +25,10 @@ Changes to be performed manually in servers to upgrade
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1
COMMENT="Scene table information. Every scene is related to some stu_pictos";`
- Add id_active_scene to student table
`ALTER TABLE student ADD COLUMN id_active_scene INT(11) DEFAULT NULL;`
`ALTER TABLE student ADD CONSTRAINT fk_active_scene FOREIGN KEY (`id_active_scene`) REFERENCES scene (`id`);`
- alter table stu_picto to add new reference to scene
`ALTER TABLE `stu_picto` ADD id_scene int(11) NOT NULL;`
`ALTER TABLE `stu_picto` ADD CONSTRAINT `stu_picto_scene_fk` FOREIGN KEY (`id_scene`) REFERENCES `scene` (`id`) ON DELETE CASCADE;`
......@@ -48,3 +39,5 @@ Changes to be performed manually in servers to upgrade
- Reload enrolments trigger
`source /vagrant/roles/database/files/triggers-enrolments-integrity-constraints.sql`
- Reload triggers-sessions-integrity-constraints.sql
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