Browse Source

[svn r15952] Added index on course_rel_user.user_id alone + moved user table creation query to be in logical declaration order

Yannick Warnier 16 years ago
parent
commit
18eb6e7f76

+ 52 - 51
main/install/dokeos_main.sql

@@ -13,6 +13,57 @@
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 
+
+--
+-- Table structure for table user
+--
+
+DROP TABLE IF EXISTS user;
+CREATE TABLE user (
+  user_id int(10) unsigned NOT NULL auto_increment,
+  lastname varchar(60) default NULL,
+  firstname varchar(60) default NULL,
+  username varchar(20) NOT NULL default '',
+  password varchar(50) NOT NULL default '',
+  auth_source varchar(50) default 'platform',
+  email varchar(100) default NULL,
+  status tinyint(4) NOT NULL default '5',
+  official_code varchar(40) default NULL,
+  phone varchar(30) default NULL,
+  picture_uri varchar(250) default NULL,
+  creator_id int(10) unsigned default NULL,
+  competences text,
+  diplomas text,
+  openarea text,
+  teach text,
+  productions varchar(250) default NULL,
+  chatcall_user_id int(10) unsigned NOT NULL default '0',
+  chatcall_date datetime NOT NULL default '0000-00-00 00:00:00',
+  chatcall_text varchar(50) NOT NULL default '',
+  language varchar(40) default NULL,
+  registration_date datetime NOT NULL default '0000-00-00 00:00:00',
+  expiration_date datetime NOT NULL default '0000-00-00 00:00:00',
+  active tinyint unsigned NOT NULL default 1,
+  openid varchar(255) DEFAULT NULL,
+  theme varchar(255) DEFAULT NULL,
+  hr_dept_id smallint unsigned NOT NULL default 0,
+  PRIMARY KEY  (user_id),
+  UNIQUE KEY username (username)
+);
+ALTER TABLE user ADD INDEX (status);
+
+--
+-- Dumping data for table user
+--
+
+/*!40000 ALTER TABLE user DISABLE KEYS */;
+LOCK TABLES user WRITE;
+INSERT INTO user (lastname, firstname, username, password, auth_source, email, status, official_code, creator_id, registration_date, expiration_date,active,openid) VALUES ('{ADMINLASTNAME}','{ADMINFIRSTNAME}','{ADMINLOGIN}','{ADMINPASSWORD}','{PLATFORM_AUTH_SOURCE}','{ADMINEMAIL}',1,'ADMIN',1,NOW(),'0000-00-00 00:00:00','1',NULL);
+-- Insert anonymous user
+INSERT INTO user (lastname, firstname, username, password, auth_source, email, status, official_code, creator_id, registration_date, expiration_date,active,openid) VALUES ('Anonymous', 'Joe', '', '', 'platform', 'anonymous@localhost', 6, 'anonymous', 1, NOW(), '0000-00-00 00:00:00', 1,NULL);
+UNLOCK TABLES;
+/*!40000 ALTER TABLE user ENABLE KEYS */;
+
 --
 -- Table structure for table admin
 --
@@ -237,6 +288,7 @@ CREATE TABLE course_rel_user (
   user_course_cat int(11) default '0',
   PRIMARY KEY  (course_code,user_id)
 );
+ALTER TABLE course_rel_user ADD INDEX (user_id);
 
 --
 -- Dumping data for table course_rel_user
@@ -740,57 +792,6 @@ LOCK TABLES sys_announcement WRITE;
 UNLOCK TABLES;
 /*!40000 ALTER TABLE sys_announcement ENABLE KEYS */;
 
---
--- Table structure for table user
---
-
-DROP TABLE IF EXISTS user;
-CREATE TABLE user (
-  user_id int(10) unsigned NOT NULL auto_increment,
-  lastname varchar(60) default NULL,
-  firstname varchar(60) default NULL,
-  username varchar(20) NOT NULL default '',
-  password varchar(50) NOT NULL default '',
-  auth_source varchar(50) default 'platform',
-  email varchar(100) default NULL,
-  status tinyint(4) NOT NULL default '5',
-  official_code varchar(40) default NULL,
-  phone varchar(30) default NULL,
-  picture_uri varchar(250) default NULL,
-  creator_id int(10) unsigned default NULL,
-  competences text,
-  diplomas text,
-  openarea text,
-  teach text,
-  productions varchar(250) default NULL,
-  chatcall_user_id int(10) unsigned NOT NULL default '0',
-  chatcall_date datetime NOT NULL default '0000-00-00 00:00:00',
-  chatcall_text varchar(50) NOT NULL default '',
-  language varchar(40) default NULL,
-  registration_date datetime NOT NULL default '0000-00-00 00:00:00',
-  expiration_date datetime NOT NULL default '0000-00-00 00:00:00',
-  active tinyint unsigned NOT NULL default 1,
-  openid varchar(255) DEFAULT NULL,
-  theme varchar(255) DEFAULT NULL,
-  hr_dept_id smallint unsigned NOT NULL default 0,
-  PRIMARY KEY  (user_id),
-  UNIQUE KEY username (username)
-);
-ALTER TABLE user ADD INDEX (status);
-
---
--- Dumping data for table user
---
-
-
-/*!40000 ALTER TABLE user DISABLE KEYS */;
-LOCK TABLES user WRITE;
-INSERT INTO user (lastname, firstname, username, password, auth_source, email, status, official_code, creator_id, registration_date, expiration_date,active,openid) VALUES ('{ADMINLASTNAME}','{ADMINFIRSTNAME}','{ADMINLOGIN}','{ADMINPASSWORD}','{PLATFORM_AUTH_SOURCE}','{ADMINEMAIL}',1,'ADMIN',1,NOW(),'0000-00-00 00:00:00','1',NULL);
--- Insert anonymous user
-INSERT INTO user (lastname, firstname, username, password, auth_source, email, status, official_code, creator_id, registration_date, expiration_date,active,openid) VALUES ('Anonymous', 'Joe', '', '', 'platform', 'anonymous@localhost', 6, 'anonymous', 1, NOW(), '0000-00-00 00:00:00', 1,NULL);
-UNLOCK TABLES;
-/*!40000 ALTER TABLE user ENABLE KEYS */;
-
 -- 
 -- Table structure for shared_survey
 -- 

+ 1 - 0
main/install/migrate-db-1.8.5-1.8.6-pre.sql

@@ -20,6 +20,7 @@ INSERT INTO settings_current (variable, subkey,type,category,selected_value,titl
 INSERT INTO settings_options (variable, value, display_text) VALUES ('add_users_by_coach', 'true', 'Yes');
 INSERT INTO settings_options (variable, value, display_text) VALUES ('add_users_by_coach', 'false', 'No');
 ALTER TABLE session ADD nb_days_access_before_beginning TINYINT NULL DEFAULT '0' AFTER date_end , ADD nb_days_access_after_end TINYINT NULL DEFAULT '0' AFTER nb_days_access_before_beginning ;
+ALTER TABLE course_rel_user ADD INDEX (user_id);
 
 -- xxSTATSxx
 

+ 2 - 2
main/install/update-db-1.8.4-1.8.5.inc.php

@@ -1,4 +1,4 @@
-<?php // $Id: update-db-1.8.4-1.8.5.inc.php 14753 2008-04-03 22:20:25Z juliomontoya $
+<?php // $Id: update-db-1.8.4-1.8.5.inc.php 15952 2008-08-08 03:56:21Z yannoo $
 /* See license terms in /dokeos_license.txt */
 /**
 ==============================================================================
@@ -250,7 +250,7 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE'))
 		else
 		{
 			mysql_select_db($dbNameForm);
-			$res = mysql_query("SELECT code,db_name,directory,course_language FROM course WHERE target_course_code IS NULL");
+			$res = mysql_query("SELECT code,db_name,directory,course_language FROM course WHERE target_course_code IS NULL ORDER BY code");
 
 			if($res===false){die('Error while querying the courses list in update_db.inc.php');}