Adding missing primary keys see #4682

skala
Julio Montoya 14 years ago
parent 7ef86e8b94
commit d8ca23eb6d
  1. 17
      main/install/db_main.sql
  2. 55
      main/install/db_stats.sql
  3. 15
      main/install/migrate-db-1.8.8-1.9.0-pre.sql

@ -870,7 +870,7 @@ VALUES
('enable_iframe_inclusion', NULL, 'radio', 'Editor', 'false', 'EnableIframeInclusionTitle', 'EnableIframeInclusionComment', NULL, NULL, 1), ('enable_iframe_inclusion', NULL, 'radio', 'Editor', 'false', 'EnableIframeInclusionTitle', 'EnableIframeInclusionComment', NULL, NULL, 1),
('show_hot_courses', NULL, 'radio', 'Platform', 'true', 'ShowHotCoursesTitle', 'ShowHotCoursesComment', NULL, NULL, 1), ('show_hot_courses', NULL, 'radio', 'Platform', 'true', 'ShowHotCoursesTitle', 'ShowHotCoursesComment', NULL, NULL, 1),
('enable_webcam_clip',NULL,'radio','Tools','false','EnableWebCamClipTitle','EnableWebCamClipComment',NULL,NULL, 0), ('enable_webcam_clip',NULL,'radio','Tools','false','EnableWebCamClipTitle','EnableWebCamClipComment',NULL,NULL, 0),
('chamilo_database_version', NULL, 'textfield',NULL, '1.9.0.18219','DatabaseVersion','', NULL, NULL, 0); ('chamilo_database_version', NULL, 'textfield',NULL, '1.9.0.18283','DatabaseVersion','', NULL, NULL, 0);
UNLOCK TABLES; UNLOCK TABLES;
/*!40000 ALTER TABLE settings_current ENABLE KEYS */; /*!40000 ALTER TABLE settings_current ENABLE KEYS */;
@ -2348,25 +2348,22 @@ CREATE TABLE IF NOT EXISTS reservation_category (
PRIMARY KEY ( id ) PRIMARY KEY ( id )
); );
-- --------------------------------------------------------
-- --
-- Table structure for table reservation category_rights -- Table structure for table reservation category_rights
-- --
DROP TABLE IF EXISTS reservation_category_rights; DROP TABLE IF EXISTS reservation_category_rights;
CREATE TABLE IF NOT EXISTS reservation_category_rights ( CREATE TABLE IF NOT EXISTS reservation_category_rights (
category_id int NOT NULL default 0, id int unsigned NOT NULL auto_increment,
class_id int NOT NULL default 0, category_id int NOT NULL default 0,
m_items tinyint NOT NULL default 0 class_id int NOT NULL default 0,
m_items tinyint NOT NULL default 0,
PRIMARY KEY ( id )
); );
-- --------------------------------------------------------
-- --
-- Table structure for table item reservation -- Table structure for table item reservation
-- --
DROP TABLE IF EXISTS reservation_item; DROP TABLE IF EXISTS reservation_item;
CREATE TABLE IF NOT EXISTS reservation_item ( CREATE TABLE IF NOT EXISTS reservation_item (
id int unsigned NOT NULL auto_increment, id int unsigned NOT NULL auto_increment,

@ -131,17 +131,18 @@ ALTER TABLE track_e_exercices ADD COLUMN questions_to_check TEXT NOT NULL DEFAU
DROP TABLE IF EXISTS track_e_attempt; DROP TABLE IF EXISTS track_e_attempt;
CREATE TABLE track_e_attempt ( CREATE TABLE track_e_attempt (
exe_id int default NULL, id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
user_id int NOT NULL default 0, exe_id int default NULL,
question_id int NOT NULL default 0, user_id int NOT NULL default 0,
answer text NOT NULL, question_id int NOT NULL default 0,
teacher_comment text NOT NULL, answer text NOT NULL,
marks float(6,2) NOT NULL default 0, teacher_comment text NOT NULL,
course_code varchar(40) NOT NULL default '', marks float(6,2) NOT NULL default 0,
position int default 0, course_code varchar(40) NOT NULL default '',
tms datetime NOT NULL default '0000-00-00 00:00:00', position int default 0,
session_id INT NOT NULL DEFAULT 0, tms datetime NOT NULL default '0000-00-00 00:00:00',
filename VARCHAR(255) DEFAULT NULL session_id INT NOT NULL DEFAULT 0,
filename VARCHAR(255) DEFAULT NULL
); );
ALTER TABLE track_e_attempt ADD INDEX (exe_id); ALTER TABLE track_e_attempt ADD INDEX (exe_id);
ALTER TABLE track_e_attempt ADD INDEX (user_id); ALTER TABLE track_e_attempt ADD INDEX (user_id);
@ -150,13 +151,14 @@ ALTER TABLE track_e_attempt ADD INDEX (session_id);
DROP TABLE IF EXISTS track_e_attempt_recording; DROP TABLE IF EXISTS track_e_attempt_recording;
CREATE TABLE track_e_attempt_recording ( CREATE TABLE track_e_attempt_recording (
exe_id int unsigned NOT NULL, id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
question_id int unsigned NOT NULL, exe_id int unsigned NOT NULL,
marks int NOT NULL, question_id int unsigned NOT NULL,
insert_date datetime NOT NULL default '0000-00-00 00:00:00', marks int NOT NULL,
author int unsigned NOT NULL, insert_date datetime NOT NULL default '0000-00-00 00:00:00',
teacher_comment text NOT NULL, author int unsigned NOT NULL,
session_id INT NOT NULL DEFAULT 0 teacher_comment text NOT NULL,
session_id INT NOT NULL DEFAULT 0
); );
ALTER TABLE track_e_attempt_recording ADD INDEX (exe_id); ALTER TABLE track_e_attempt_recording ADD INDEX (exe_id);
ALTER TABLE track_e_attempt_recording ADD INDEX (question_id); ALTER TABLE track_e_attempt_recording ADD INDEX (question_id);
@ -164,14 +166,15 @@ ALTER TABLE track_e_attempt_recording ADD INDEX (session_id);
DROP TABLE IF EXISTS track_e_hotpotatoes; DROP TABLE IF EXISTS track_e_hotpotatoes;
CREATE TABLE track_e_hotpotatoes ( CREATE TABLE track_e_hotpotatoes (
exe_name VARCHAR( 255 ) NOT NULL , id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
exe_user_id int unsigned DEFAULT NULL , exe_name VARCHAR( 255 ) NOT NULL ,
exe_date DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL , exe_user_id int unsigned DEFAULT NULL ,
exe_cours_id varchar(40) NOT NULL , exe_date DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL ,
exe_result smallint default 0 NOT NULL , exe_cours_id varchar(40) NOT NULL ,
exe_weighting smallint default 0 NOT NULL, exe_result smallint default 0 NOT NULL ,
KEY exe_user_id (exe_user_id), exe_weighting smallint default 0 NOT NULL,
KEY exe_cours_id (exe_cours_id) KEY exe_user_id (exe_user_id),
KEY exe_cours_id (exe_cours_id)
); );
DROP TABLE IF EXISTS track_e_links; DROP TABLE IF EXISTS track_e_links;

@ -261,10 +261,11 @@ INSERT INTO settings_options (variable, value, display_text) values ('platform_u
DROP TABLE IF EXISTS access_url_rel_session; DROP TABLE IF EXISTS access_url_rel_session;
ALTER TABLE usergroup_rel_session ADD COLUMN id INTEGER NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (id); ALTER TABLE usergroup_rel_session ADD COLUMN id INTEGER NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (id);
ALTER TABLE usergroup_rel_course ADD COLUMN id INTEGER NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (id); ALTER TABLE usergroup_rel_course ADD COLUMN id INTEGER NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (id);
ALTER TABLE usergroup_rel_user ADD COLUMN id INTEGER NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (id); ALTER TABLE usergroup_rel_user ADD COLUMN id INTEGER NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (id);
ALTER TABLE admin ADD COLUMN id INTEGER NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (id); ALTER TABLE admin ADD COLUMN id INTEGER NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (id);
ALTER TABLE reservation_category_rights ADD COLUMN id INTEGER NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (id);
-- Remove settings entry that doesnt exist anymore -- Remove settings entry that doesnt exist anymore
@ -273,7 +274,7 @@ DELETE FROM settings_current WHERE variable = "user_order_by";
DELETE FROM settings_options WHERE variable = "user_order_by"; DELETE FROM settings_options WHERE variable = "user_order_by";
-- Do not move this query -- Do not move this query
UPDATE settings_current SET selected_value = '1.9.0.18219' WHERE variable = 'chamilo_database_version'; UPDATE settings_current SET selected_value = '1.9.0.18283' WHERE variable = 'chamilo_database_version';
-- xxSTATSxx -- xxSTATSxx
ALTER TABLE track_e_exercices ADD COLUMN questions_to_check TEXT NOT NULL DEFAULT ''; ALTER TABLE track_e_exercices ADD COLUMN questions_to_check TEXT NOT NULL DEFAULT '';
@ -289,6 +290,10 @@ ALTER TABLE track_stored_values_stack ADD UNIQUE (user_id, sco_id, course_id, sv
ALTER TABLE track_e_attempt ADD COLUMN filename VARCHAR(255) DEFAULT NULL; ALTER TABLE track_e_attempt ADD COLUMN filename VARCHAR(255) DEFAULT NULL;
ALTER TABLE track_e_default ADD COLUMN c_id INTEGER DEFAULT NULL; ALTER TABLE track_e_default ADD COLUMN c_id INTEGER DEFAULT NULL;
ALTER TABLE track_e_attempt_recording ADD COLUMN id INTEGER NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (id);
ALTER TABLE track_e_attempt ADD COLUMN id INTEGER NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (id);
ALTER TABLE track_e_hotpotatoes ADD COLUMN id INTEGER NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (id);
-- xxUSERxx -- xxUSERxx
-- xxCOURSExx -- xxCOURSExx

Loading…
Cancel
Save