remove old readme
[atutor.git] / docs / install / db / atutor_upgrade_1.6_to_1.6.1.sql
1 ###############################################################
2 # Database upgrade SQL from ATutor 1.6 to ATutor 1.6.1
3 ###############################################################
4
5 # support new changes for Test/Survey
6 ALTER TABLE `tests`
7 ADD `description` TEXT NOT NULL, 
8 ADD `passscore` MEDIUMINT NOT NULL, 
9 ADD `passpercent` MEDIUMINT NOT NULL,
10 ADD `passfeedback` TEXT NOT NULL, 
11 ADD `failfeedback` TEXT NOT NULL;
12
13 # support auto enrollment at registration
14 CREATE TABLE `auto_enroll` (
15    `auto_enroll_id` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
16    `associate_string` VARCHAR(10) NOT NULL,
17    `name` VARCHAR( 50 ) NOT NULL default '',
18    PRIMARY KEY ( `auto_enroll_id` )
19 ) DEFAULT CHARACTER SET = 'utf8';
20
21 CREATE TABLE `auto_enroll_courses` (
22    `auto_enroll_courses_id` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
23    `auto_enroll_id` MEDIUMINT UNSIGNED NOT NULL default 0,
24    `course_id` MEDIUMINT UNSIGNED NOT NULL default 0,
25    PRIMARY KEY ( `auto_enroll_courses_id` )
26 ) DEFAULT CHARACTER SET = 'utf8';
27
28 # course directory name
29 ALTER TABLE `courses` ADD COLUMN `course_dir_name` VARCHAR(255) NOT NULL AFTER `description`;
30
31 # Extend members.password for encrypted password
32 ALTER TABLE `members` MODIFY password VARCHAR(40);
33 UPDATE `members` SET password = SHA1(password), creation_date=creation_date, last_login=last_login WHERE CHAR_LENGTH(password) < 40;
34
35 # --------------------------------------------------------
36 # Table structure for table `patches`
37 # since 1.6.1
38
39 CREATE TABLE `patches` (
40         `patches_id` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
41         `atutor_patch_id` VARCHAR(20) NOT NULL default '',
42         `applied_version` VARCHAR(10) NOT NULL default '',
43         `patch_folder` VARCHAR(250) NOT NULL default '',
44   `description` TEXT NOT NULL,
45         `available_to` VARCHAR(250) NOT NULL default '',
46   `sql_statement` text NOT NULL,
47   `status` varchar(20) NOT NULL default '',
48   `remove_permission_files` text NOT NULL,
49   `backup_files` text NOT NULL,
50   `patch_files` text NOT NULL,
51         PRIMARY KEY  (`patches_id`)
52 ) DEFAULT CHARACTER SET = 'utf8';
53
54
55 # --------------------------------------------------------
56 # Table structure for table `patches_files`
57 # since 1.6.1
58
59 CREATE TABLE `patches_files` (
60         `patches_files_id` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
61         `patches_id` MEDIUMINT UNSIGNED NOT NULL default 0,
62         `action` VARCHAR(20) NOT NULL default '',
63         `name` TEXT NOT NULL,
64         `location` VARCHAR(250) NOT NULL default '',
65         PRIMARY KEY  (`patches_files_id`)
66 ) DEFAULT CHARACTER SET = 'utf8';;
67
68 # --------------------------------------------------------
69 # Table structure for table `patches_files_actions`
70 # since 1.6.1
71
72 CREATE TABLE `patches_files_actions` (
73         `patches_files_actions_id` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
74         `patches_files_id` MEDIUMINT UNSIGNED NOT NULL default 0,
75         `action` VARCHAR(20) NOT NULL default '',
76         `code_from` TEXT NOT NULL,
77         `code_to` TEXT NOT NULL,
78         PRIMARY KEY  (`patches_files_actions_id`)
79 ) DEFAULT CHARACTER SET = 'utf8';
80
81
82
83 # --------------------------------------------------------
84 # New tables for patch creator
85 # since 1.6.1
86
87 CREATE TABLE `myown_patches` (
88         `myown_patch_id` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
89         `atutor_patch_id` VARCHAR(20) NOT NULL default '',
90         `applied_version` VARCHAR(10) NOT NULL default '',
91   `description` TEXT NOT NULL,
92   `sql_statement` text NOT NULL,
93   `status` varchar(20) NOT NULL default '',
94   `last_modified` datetime NOT NULL,
95         PRIMARY KEY  (`myown_patch_id`)
96 ) DEFAULT CHARACTER SET = 'utf8';;
97
98 CREATE TABLE `myown_patches_dependent` (
99         `myown_patches_dependent_id` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
100         `myown_patch_id` MEDIUMINT UNSIGNED NOT NULL,
101         `dependent_patch_id` VARCHAR(50) NOT NULL default '',
102         PRIMARY KEY  (`myown_patches_dependent_id`)
103 ) DEFAULT CHARACTER SET = 'utf8';
104
105 CREATE TABLE `myown_patches_files` (
106         `myown_patches_files_id` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
107         `myown_patch_id` MEDIUMINT UNSIGNED NOT NULL,
108         `action` VARCHAR(20) NOT NULL default '',
109         `name` VARCHAR(250) NOT NULL,
110         `location` VARCHAR(250) NOT NULL default '',
111         `code_from` TEXT NOT NULL,
112         `code_to` TEXT NOT NULL,
113         `uploaded_file` TEXT NOT NULL,
114         PRIMARY KEY  (`myown_patches_files_id`)
115 ) DEFAULT CHARACTER SET = 'utf8';
116
117 # --------------------------------------------------------
118 # Include Patcher as a standard module
119 # since 1.6.1
120
121 INSERT INTO `modules`
122 SELECT '_standard/patcher', 2, 0, MAX(admin_privilege)*2, 0, 0 FROM `modules`;
123
124 # --------------------------------------------------------
125 # Support customized head
126 # since 1.6.1
127
128 ALTER TABLE `content`
129 ADD head TEXT NOT NULL, 
130 ADD use_customized_head TINYINT(4) NOT NULL;
131
132 # --------------------------------------------------------
133 # courses.created_date is modified to datetime
134 # remove unused fields: courses.preferences, courses.header, courses.footer, courses.banner_text, courses.banner_styles
135 # since 1.6.1
136
137 ALTER TABLE `courses` MODIFY created_date DATETIME;
138 ALTER TABLE `courses` DROP preferences, DROP header, DROP footer, DROP banner_text, DROP banner_styles;
139
140 #---------------------------------------------------------
141 # Adds the fluid theme to the default theme provided in the public distribution
142 INSERT INTO `themes` VALUES ('Fluid', '1.6.1', 'fluid', NOW(), 'Theme that implements the Fluid reorderer used to drag-and-drop the menu from side-to-side.', 1);
143
144 # --------------------------------------------------------
145 # Increase course icon filename size
146 # http://www.atutor.ca/atutor/mantis/view.php?id=3319
147 ALTER TABLE `courses` MODIFY COLUMN `icon` VARCHAR(75);