|
|
|
|
@ -1,15 +1,15 @@ |
|
|
|
|
-- This script updates the databases structure before migrating the data from |
|
|
|
|
-- version 1.6.x to version 1.8.0 |
|
|
|
|
-- it is intended as a standalone script, however, because of the multiple |
|
|
|
|
-- it is intended as a standalone script, however, because of the multiple |
|
|
|
|
-- databases related difficulties, it should be parsed by a PHP script in |
|
|
|
|
-- order to connect to and update the right databases. |
|
|
|
|
-- There is one line per query, allowing the PHP function file() to read |
|
|
|
|
-- all lines separately into an array. The xxMAINxx-type markers are there |
|
|
|
|
-- There is one line per query, allowing the PHP function file() to read |
|
|
|
|
-- all lines separately into an array. The xxMAINxx-type markers are there |
|
|
|
|
-- to tell the PHP script which database we're talking about. |
|
|
|
|
-- By always using the keyword "TABLE" in the queries, we should be able |
|
|
|
|
-- to retrieve and modify the table name from the PHP script if needed, which |
|
|
|
|
-- will allow us to deal with the unique-database-type installations |
|
|
|
|
-- |
|
|
|
|
-- |
|
|
|
|
-- This first part is for the main database |
|
|
|
|
-- xxMAINxx |
|
|
|
|
ALTER TABLE admin CHANGE user_id user_id int unsigned NOT NULL default '0'; |
|
|
|
|
@ -19,24 +19,24 @@ ALTER TABLE course ADD registration_code varchar(255) NOT NULL default ''; |
|
|
|
|
ALTER TABLE course_rel_class CHANGE class_id class_id mediumint unsigned NOT NULL default '0'; |
|
|
|
|
ALTER TABLE course_rel_user CHANGE user_id user_id int unsigned NOT NULL default '0'; |
|
|
|
|
-- Rename table session into php_session |
|
|
|
|
RENAME TABLE sess TO php_session; |
|
|
|
|
-- We might want to review the following table structure -- |
|
|
|
|
RENAME TABLE sess TO php_session; |
|
|
|
|
-- We might want to review the following table structure -- |
|
|
|
|
CREATE TABLE session (id smallint unsigned NOT NULL auto_increment, id_coach int unsigned NOT NULL default '0', name char(50) NOT NULL default '', nbr_courses smallint unsigned NOT NULL default '0', nbr_users mediumint unsigned NOT NULL default '0', nbr_classes mediumint unsigned NOT NULL default '0', date_start date NOT NULL default '0000-00-00', date_end date NOT NULL default '0000-00-00', PRIMARY KEY (id), UNIQUE KEY name (name)); |
|
|
|
|
-- We might want to review the following table structure -- |
|
|
|
|
-- We might want to review the following table structure -- |
|
|
|
|
CREATE TABLE session_rel_course(id_session smallint unsigned NOT NULL default '0', course_code char(40) NOT NULL default '', id_coach int unsigned NOT NULL default '0', nbr_users smallint(5) unsigned NOT NULL default '0', PRIMARY KEY (id_session,course_code), KEY course_code (course_code)); |
|
|
|
|
-- We might want to review the following table structure -- |
|
|
|
|
-- We might want to review the following table structure -- |
|
|
|
|
CREATE TABLE session_rel_course_rel_user(id_session smallint unsigned NOT NULL default '0', course_code char(40) NOT NULL default '', id_user int unsigned NOT NULL default '0', PRIMARY KEY (id_session,course_code,id_user), KEY id_user (id_user), KEY course_code (course_code)); |
|
|
|
|
-- We might want to review the following table structure -- |
|
|
|
|
-- We might want to review the following table structure -- |
|
|
|
|
CREATE TABLE session_rel_user(id_session mediumint unsigned NOT NULL default '0', id_user mediumint unsigned NOT NULL default '0', PRIMARY KEY (id_session,id_user)); |
|
|
|
|
-- We might want to review the following table structure -- |
|
|
|
|
-- We might want to review the following table structure -- |
|
|
|
|
CREATE TABLE course_rel_survey (id int NOT NULL auto_increment, course_code varchar(200) default NULL, db_name varchar(200) default NULL, survey_id varchar(200) default NULL, PRIMARY KEY (id)); |
|
|
|
|
-- We might want to review the following table structure -- |
|
|
|
|
-- We might want to review the following table structure -- |
|
|
|
|
CREATE TABLE survey_reminder(sid int NOT NULL default '0', db_name varchar(100) NOT NULL default '', email varchar(100) NOT NULL default '', access int NOT NULL default '0', subject text NOT NULL, content text NOT NULL, reminder_choice int NOT NULL default '0', reminder_time text NOT NULL, avail_till date NOT NULL default '0000-00-00'); |
|
|
|
|
-- We might want to review the following table structure -- |
|
|
|
|
-- We might want to review the following table structure -- |
|
|
|
|
CREATE TABLE survey_user_info(id int NOT NULL auto_increment, user_id int NOT NULL default '0', survey_id int NOT NULL default '0', db_name varchar(200) default NULL, firstname varchar(200) default NULL, lastname varchar(200) default NULL, email varchar(200) default NULL, organization text, age int default NULL, registered char(1) default NULL, attempted varchar(10) NOT NULL default '', PRIMARY KEY (id)); |
|
|
|
|
-- ALTER TABLE sys_announcement CHANGE visible_student visible_student enum('0','1') NOT NULL default '0'; |
|
|
|
|
-- ALTER TABLE sys_announcement CHANGE visible_guest visible_guest enum('0','1') NOT NULL default '0'; |
|
|
|
|
ALTER TABLE sys_announcement ADD lang varchar(70) NOT NULL default ''; |
|
|
|
|
ALTER TABLE sys_announcement ADD lang varchar(70) NULL; |
|
|
|
|
ALTER TABLE user CHANGE auth_source auth_source varchar(50) default 'platform'; |
|
|
|
|
ALTER TABLE user ADD language varchar(40) default NULL; |
|
|
|
|
ALTER TABLE user ADD registration_date datetime NOT NULL default '0000-00-00 00:00:00'; |
|
|
|
|
@ -66,7 +66,7 @@ CREATE TABLE course_setting(id int unsigned NOT NULL auto_increment, variable va |
|
|
|
|
CREATE TABLE dropbox_category(cat_id int NOT NULL auto_increment, cat_name text NOT NULL, received enum('0','1') NOT NULL default '0', sent enum('0','1') NOT NULL default '0', user_id int NOT NULL default '0', PRIMARY KEY (cat_id)); |
|
|
|
|
CREATE TABLE dropbox_feedback(feedback_id int NOT NULL auto_increment, file_id int NOT NULL default '0', author_user_id int NOT NULL default '0', feedback text NOT NULL, feedback_date datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (feedback_id), KEY file_id (file_id), KEY author_user_id (author_user_id)); |
|
|
|
|
CREATE TABLE forum_category(cat_id int NOT NULL auto_increment, cat_title varchar(255) NOT NULL default '', cat_comment text, cat_order int(11) NOT NULL default '0', locked int(5) NOT NULL default '0', PRIMARY KEY (cat_id)); |
|
|
|
|
CREATE TABLE forum_forum(forum_id int NOT NULL auto_increment, forum_title varchar(255) NOT NULL default '', forum_comment text, forum_threads int default '0', forum_posts int default '0', forum_last_post int default '0', forum_category int default NULL, allow_anonymous int default NULL, allow_edit int default NULL, approval_direct_post varchar(20) default NULL, allow_attachments int default NULL, allow_new_threads int default NULL, default_view varchar(20) default NULL, forum_of_group varchar(20) default NULL, forum_group_public_private varchar(20) default 'public', forum_order int default NULL, locked int NOT NULL default '0', PRIMARY KEY (forum_id)); |
|
|
|
|
CREATE TABLE forum_forum(forum_id int NOT NULL auto_increment, forum_title varchar(255) NOT NULL default '', forum_comment text, forum_threads int default '0', forum_posts int default '0', forum_last_post int default '0', forum_category int default NULL, allow_anonymous int default NULL, allow_edit int default NULL, approval_direct_post varchar(20) default NULL, allow_attachments int default NULL, allow_new_threads int default NULL, default_view varchar(20) default NULL, forum_of_group varchar(20) default NULL, forum_group_public_private varchar(20) default 'public', forum_order int default NULL, locked int NOT NULL default '0', PRIMARY KEY (forum_id)); |
|
|
|
|
CREATE TABLE forum_mailcue(thread_id int default NULL, user_id int default NULL, post_id int default NULL); |
|
|
|
|
CREATE TABLE forum_post(post_id int NOT NULL auto_increment, post_title varchar(250) default NULL, post_text text, thread_id int default '0', forum_id int default '0', poster_id int default '0', poster_name varchar(100) default '', post_date datetime default '0000-00-00 00:00:00', post_notification int default '0', post_parent_id int default '0', visible int default '1', PRIMARY KEY (post_id), KEY poster_id (poster_id), KEY forum_id (forum_id)); |
|
|
|
|
CREATE TABLE forum_thread(thread_id int NOT NULL auto_increment,thread_title varchar(255) default NULL, forum_id int default NULL, thread_replies int default '0', thread_poster_id int default NULL, thread_poster_name int default '0', thread_views int default '0', thread_last_post int default NULL, thread_date datetime default '0000-00-00 00:00:00', thread_sticky int default '0', locked int NOT NULL default '0', PRIMARY KEY (thread_id), KEY thread_id (thread_id)); |
|
|
|
|
|