diff --git a/main/install/db_main.sql b/main/install/db_main.sql index 61408f79d0..81bfd0fa44 100644 --- a/main/install/db_main.sql +++ b/main/install/db_main.sql @@ -328,7 +328,7 @@ CREATE TABLE course_rel_user ( sort int default NULL, user_course_cat int default '0', relation_type int default 0, - PRIMARY KEY (course_code,user_id) + PRIMARY KEY (course_code,user_id,relation_type) ); ALTER TABLE course_rel_user ADD INDEX (user_id); @@ -502,7 +502,7 @@ CREATE TABLE session_rel_user ( id_session mediumint unsigned NOT NULL default '0', id_user mediumint unsigned NOT NULL default '0', relation_type int default 0, - PRIMARY KEY (id_session,id_user) + PRIMARY KEY (id_session,id_user,relation_type) ); @@ -754,7 +754,7 @@ VALUES ('show_tabs', 'dashboard', 'checkbox', 'Platform', 'true', 'ShowTabsTitle', 'ShowTabsComment', NULL, 'TabsDashboard', 1), ('use_users_timezone', 'timezones', 'radio', 'Timezones', 'true', 'UseUsersTimezoneTitle','UseUsersTimezoneComment',NULL,'Timezones', 1), ('timezone_value', 'timezones', 'select', 'Timezones', '', 'TimezoneValueTitle','TimezoneValueComment',NULL,'Timezones', 1), -('dokeos_database_version', NULL, 'textfield', NULL,'1.8.7.10741','DokeosDatabaseVersion','',NULL,NULL,0); +('dokeos_database_version', NULL, 'textfield', NULL,'1.8.7.10879','DokeosDatabaseVersion','',NULL,NULL,0); UNLOCK TABLES; diff --git a/main/install/migrate-db-1.8.6.2-1.8.7-pre.sql b/main/install/migrate-db-1.8.6.2-1.8.7-pre.sql index 64a2672112..fda90e7989 100755 --- a/main/install/migrate-db-1.8.6.2-1.8.7-pre.sql +++ b/main/install/migrate-db-1.8.6.2-1.8.7-pre.sql @@ -50,6 +50,9 @@ ALTER TABLE user_field_values ADD INDEX (user_id, field_id); UPDATE settings_current SET selected_value = '1.8.7.10741' WHERE variable = 'dokeos_database_version'; +ALTER TABLE course_rel_user DROP PRIMARY KEY, ADD PRIMARY KEY (course_code, user_id, relation_type); +ALTER TABLE session_rel_user DROP PRIMARY KEY, ADD PRIMARY KEY (id_session, id_user, relation_type); + -- xxSTATSxx CREATE TABLE track_e_item_property(id int NOT NULL auto_increment PRIMARY KEY, course_id int NOT NULL, item_property_id int NOT NULL, title varchar(255), content text, progress int NOT NULL default 0, lastedit_date datetime NOT NULL default '0000-00-00 00:00:00', lastedit_user_id int NOT NULL, session_id int NOT NULL default 0); ALTER TABLE track_e_item_property ADD INDEX (course_id, item_property_id, session_id);