Răsfoiți Sursa

Fixing table creation in the chat table

Julio Montoya 13 ani în urmă
părinte
comite
d637e9f848
2 a modificat fișierele cu 8 adăugiri și 7 ștergeri
  1. 5 4
      main/install/db_main.sql
  2. 3 3
      main/install/migrate-db-1.8.8-1.9.0-pre.sql

+ 5 - 4
main/install/db_main.sql

@@ -2849,7 +2849,7 @@ ALTER TABLE user_course_vote ADD INDEX idx_ucv_cid (c_id);
 ALTER TABLE user_course_vote ADD INDEX idx_ucv_uid (user_id);
 ALTER TABLE user_course_vote ADD INDEX idx_ucv_cuid (user_id, c_id);
 
-
+-- Global chat
 CREATE TABLE chat (
 	id			INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
 	from_user	INTEGER,
@@ -2857,7 +2857,8 @@ CREATE TABLE chat (
 	message		TEXT NOT NULL,
 	sent		DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
 	recd		INTEGER UNSIGNED NOT NULL DEFAULT 0,
-	PRIMARY KEY (id),
-	INDEX to (to),
- INDEX from (from)
+	PRIMARY KEY (id)	
 );
+
+ALTER TABLE chat ADD INDEX idx_chat_to_user (to_user);
+ALTER TABLE chat ADD INDEX idx_chat_from_user (from_user);

+ 3 - 3
main/install/migrate-db-1.8.8-1.9.0-pre.sql

@@ -108,14 +108,11 @@ INSERT INTO settings_current (variable, subkey, type, category, selected_value,
 INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_users_to_change_email_with_no_password', 'true', 'Yes');
 INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_users_to_change_email_with_no_password', 'false', 'No');
 
-
-
 ALTER TABLE course_rel_user ADD COLUMN legal_agreement INTEGER DEFAULT 0;
 ALTER TABLE session_rel_course_rel_user ADD COLUMN legal_agreement INTEGER DEFAULT 0;
 ALTER TABLE course ADD COLUMN legal TEXT NOT NULL;
 ALTER TABLE course ADD COLUMN activate_legal INT NOT NULL DEFAULT 0;
 
-
 INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('enable_help_link', NULL, 'radio', 'Platform', 'true', 'EnableHelpLinkTitle', 'EnableHelpLinkTitle', NULL, NULL, 0);
 INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_help_link', 'true', 'Yes');
 INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_help_link', 'false', 'No');
@@ -140,6 +137,9 @@ INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_glob
 INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_global_chat', 'false', 'No');
 
 
+CREATE TABLE chat (id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, from_user INTEGER, to_user INTEGER, message TEXT NOT NULL, sent DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', recd INTEGER UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (id));
+ALTER TABLE chat ADD INDEX idx_chat_to_user (to_user);
+ALTER TABLE chat ADD INDEX idx_chat_from_user (from_user);
 
 -- Course ranking