remove old readme
[atutor.git] / install / db / atutor_upgrade_1.2_to_1.3.sql
1 ###############################################################
2 # Database upgrade SQL from ATutor 1.2.x to ATutor 1.3
3 ###############################################################
4
5
6 # add two new fields to content table, change ints to medints
7
8 ALTER TABLE `content` CHANGE `content_id` `content_id` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT, CHANGE `content_parent_id` `content_parent_id` MEDIUMINT UNSIGNED DEFAULT '0' NOT NULL;
9
10 ALTER TABLE `content` ADD `keywords` VARCHAR( 100 ) NOT NULL AFTER `release_date` , ADD `content_path` VARCHAR( 100 ) NOT NULL AFTER `keywords`;
11 #----------------------------------------------------------------
12
13 # create table `course_cats`
14
15 CREATE TABLE course_cats (
16   cat_id mediumint(8) unsigned NOT NULL auto_increment,
17   cat_name varchar(100) NOT NULL default '',
18   cat_parent mediumint(8) unsigned NOT NULL default '0',
19   PRIMARY KEY  (cat_id)
20 ) TYPE=MyISAM;
21 #----------------------------------------------------------------
22
23 # add two new fields to courses table, then set default content_packaging for all records
24
25 ALTER TABLE `courses` ADD `cat_id` MEDIUMINT( 8 ) UNSIGNED DEFAULT '0' NOT NULL AFTER `member_id` ,
26 ADD `content_packaging` ENUM( 'none', 'top', 'all' ) DEFAULT 'top' NOT NULL AFTER `cat_id` ;
27
28 UPDATE `courses` SET `content_packaging`='top' WHERE 1;
29 #----------------------------------------------------------------
30
31 # change ints to medints
32
33 ALTER TABLE `g_click_data` CHANGE `from_cid` `from_cid` MEDIUMINT UNSIGNED DEFAULT '0' NOT NULL ,
34 CHANGE `to_cid` `to_cid` MEDIUMINT UNSIGNED DEFAULT '0' NOT NULL; 
35 #----------------------------------------------------------------
36
37 # add one new record to g_refs
38
39 INSERT INTO `g_refs` ( `g_id` , `reference` ) VALUES ('36', 'g_from_tracker');
40 UPDATE `g_refs` SET reference='g_content_packaging' WHERE g_id=27;
41
42 #----------------------------------------------------------------
43
44 #
45 # Table structure for table `lang2`
46 #
47
48 DROP TABLE `lang2`;
49
50 CREATE TABLE `lang2` (
51   `lang` char(3) NOT NULL default '',
52   `variable` varchar(30) NOT NULL default '',
53   `key` varchar(50) NOT NULL default '',
54   `text` text NOT NULL,
55   `revised_date` datetime NOT NULL default '0000-00-00 00:00:00',
56   PRIMARY KEY  (`lang`,`variable`,`key`),
57   KEY `lang_variable` (`lang`,`variable`)
58 ) TYPE=MyISAM;
59
60
61
62 #----------------------------------------------------------------
63
64 # change id's to medium ints instead of ints in 'related_content`
65
66 ALTER TABLE `related_content` CHANGE `content_id` `content_id` MEDIUMINT UNSIGNED DEFAULT '0' NOT NULL ,
67 CHANGE `related_content_id` `related_content_id` MEDIUMINT UNSIGNED DEFAULT '0' NOT NULL;
68
69 #----------------------------------------------------------------
70
71 # change id's to medium ints instead of big ints in 'resource_categories`
72
73 ALTER TABLE `resource_categories` CHANGE `CatID` `CatID` MEDIUMINT( 8 ) UNSIGNED NOT NULL AUTO_INCREMENT, CHANGE `CatParent` `CatParent` MEDIUMINT( 8 ) UNSIGNED DEFAULT NULL; 
74 #----------------------------------------------------------------
75
76 # this one too 
77
78 ALTER TABLE `resource_links` CHANGE `LinkID` `LinkID` MEDIUMINT( 8 ) UNSIGNED NOT NULL AUTO_INCREMENT, CHANGE `CatID` `CatID` MEDIUMINT( 8 ) UNSIGNED DEFAULT '0' NOT NULL;
79 #----------------------------------------------------------------
80
81 # revise the theme_settings preferences for two records
82
83 UPDATE `theme_settings` SET `preferences` = 'a:27:{s:10:"PREF_STACK";a:6:{i:0;s:1:"5";i:1;s:1:"0";i:2;s:1:"1";i:3;s:1:"3";i:4;s:1:"4";i:5;s:1:"2";}s:19:"PREF_MAIN_MENU_SIDE";i:2;s:8:"PREF_SEQ";i:1;s:14:"PREF_NUMBERING";i:1;s:8:"PREF_TOC";i:1;s:14:"PREF_SEQ_ICONS";i:2;s:14:"PREF_NAV_ICONS";i:2;s:16:"PREF_LOGIN_ICONS";i:2;s:13:"PREF_HEADINGS";i:0;s:16:"PREF_BREADCRUMBS";i:0;s:9:"PREF_FONT";i:0;s:15:"PREF_STYLESHEET";i:0;s:9:"PREF_HELP";i:0;s:14:"PREF_MINI_HELP";i:1;s:18:"PREF_CONTENT_ICONS";i:2;s:14:"PREF_MAIN_MENU";i:0;s:11:"PREF_ONLINE";i:0;s:9:"PREF_MENU";i:1;s:10:"PREF_THEME";i:0;s:12:"PREF_DISPLAY";i:0;s:9:"PREF_TIPS";i:0;s:13:"PREF_OVERRIDE";i:1;s:9:"PREF_EDIT";i:1;s:10:"PREF_LOCAL";i:0;s:13:"PREF_GLOSSARY";i:0;s:11:"PREF_SEARCH";i:1;s:12:"PREF_RELATED";i:0;}' WHERE `theme_id` = '1' LIMIT 1 ;
84
85 UPDATE `theme_settings` SET `preferences` = 'a:27:{s:10:"PREF_STACK";a:6:{i:0;s:1:"0";i:1;s:1:"1";i:2;s:1:"2";i:3;s:1:"3";i:4;s:1:"4";i:5;s:1:"5";}s:19:"PREF_MAIN_MENU_SIDE";i:2;s:8:"PREF_SEQ";i:3;s:14:"PREF_NUMBERING";i:1;s:8:"PREF_TOC";i:1;s:14:"PREF_SEQ_ICONS";i:1;s:14:"PREF_NAV_ICONS";i:0;s:16:"PREF_LOGIN_ICONS";i:0;s:13:"PREF_HEADINGS";i:1;s:16:"PREF_BREADCRUMBS";i:1;s:9:"PREF_FONT";i:0;s:15:"PREF_STYLESHEET";i:0;s:9:"PREF_HELP";i:1;s:14:"PREF_MINI_HELP";i:1;s:18:"PREF_CONTENT_ICONS";i:0;s:14:"PREF_MAIN_MENU";i:1;s:11:"PREF_ONLINE";i:1;s:9:"PREF_MENU";i:1;s:13:"PREF_OVERRIDE";i:1;s:11:"PREF_SEARCH";i:1;s:10:"PREF_THEME";i:0;s:12:"PREF_DISPLAY";i:0;s:9:"PREF_TIPS";i:0;s:9:"PREF_EDIT";i:1;s:10:"PREF_LOCAL";i:0;s:13:"PREF_GLOSSARY";i:0;s:12:"PREF_RELATED";i:0;}' WHERE `theme_id` = '4' LIMIT 1 ;
86 #----------------------------------------------------------------