Index: lams_common/db/model/lams_11.clay =================================================================== RCS file: /usr/local/cvsroot/lams_common/db/model/lams_11.clay,v diff -u -r1.78 -r1.79 --- lams_common/db/model/lams_11.clay 15 May 2007 23:41:44 -0000 1.78 +++ lams_common/db/model/lams_11.clay 17 May 2007 06:34:33 -0000 1.79 @@ -1519,7 +1519,13 @@ - + + + + + + + Index: lams_common/db/sql/create_lams_11_tables.sql =================================================================== RCS file: /usr/local/cvsroot/lams_common/db/sql/create_lams_11_tables.sql,v diff -u -r1.93 -r1.94 --- lams_common/db/sql/create_lams_11_tables.sql 15 May 2007 23:41:44 -0000 1.93 +++ lams_common/db/sql/create_lams_11_tables.sql 17 May 2007 06:35:03 -0000 1.94 @@ -845,6 +845,7 @@ , create_date_time DATETIME NOT NULL , to_ui_id INT(11) , from_ui_id INT(11) + , UNIQUE UQ_transition_activities (from_activity_id, to_activity_id) , PRIMARY KEY (transition_id) , INDEX (from_activity_id) , CONSTRAINT FK_learning_transition_3 FOREIGN KEY (from_activity_id) Index: lams_common/db/sql/updatescripts/alter_203_transition.sql =================================================================== RCS file: /usr/local/cvsroot/lams_common/db/sql/updatescripts/Attic/alter_203_transition.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_common/db/sql/updatescripts/alter_203_transition.sql 17 May 2007 06:33:51 -0000 1.1 @@ -0,0 +1,7 @@ +-- Script to be run for LAMS 2.0.3 release, on LAMS 2.0.2 tables. +-- Add a new unique index to the transition table as duplicates cause an error in authoring (LDEV-1229) + +ALTER TABLE lams_learning_transition +ADD UNIQUE UQ_transition_activities (from_activity_id, to_activity_id); + +COMMIT; Index: lams_common/db/sql/updatescripts/check_203_upgrade_okay.sql =================================================================== RCS file: /usr/local/cvsroot/lams_common/db/sql/updatescripts/Attic/check_203_upgrade_okay.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_common/db/sql/updatescripts/check_203_upgrade_okay.sql 17 May 2007 06:33:51 -0000 1.1 @@ -0,0 +1,16 @@ +-- Script to be run for LAMS 2.0.3 release, on LAMS 2.0.2 tables. +-- We will be adding a new unique index on the lams_learning_transition table, so we need to check that this will work +-- ie that there aren't duplicates already. If there are duplicates, then the installer MUST STOP! + +CREATE TEMPORARY TABLE tmp_check_tran +SELECT transition_id, concat(to_activity_id, '-', from_activity_id) AS activity_ids +FROM lams_learning_transition; + +CREATE TEMPORARY TABLE tmp_check_tran_count +SELECT activity_ids, count(*) AS number_of_occurances +FROM tmp_check_tran +GROUP BY activity_ids; + +SELECT * from tmp_check_tran_count +WHERE number_of_occurances > 1 +