MDL-15476
[moodle-linuxchix.git] / backup / db / postgres7.php
blob87fa622507ebc120647ec550751a00f1fa22d2b1
1 <?php //$Id$
3 // THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
4 //
5 // IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
6 // LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
8 function backup_upgrade($oldversion=0) {
10 global $CFG;
12 $result = true;
14 if ($oldversion < 2006011600 and $result) {
15 $result = execute_sql("DROP TABLE {$CFG->prefix}backup_files");
16 if ($result) {
17 $result = execute_sql("CREATE TABLE {$CFG->prefix}backup_files (
18 id SERIAL PRIMARY KEY,
19 backup_code integer NOT NULL default '0',
20 file_type varchar(10) NOT NULL default '',
21 path varchar(255) NOT NULL default '',
22 old_id integer default NULL,
23 new_id integer default NULL,
24 CONSTRAINT {$CFG->prefix}backup_files_uk UNIQUE (backup_code, file_type, path))");
26 if ($result) {
27 $result = execute_sql("DROP TABLE {$CFG->prefix}backup_ids");
29 if ($result) {
30 $result = execute_sql("CREATE TABLE {$CFG->prefix}backup_ids (
31 id SERIAL PRIMARY KEY,
32 backup_code integer NOT NULL default '0',
33 table_name varchar(30) NOT NULL default '',
34 old_id integer NOT NULL default '0',
35 new_id integer default NULL,
36 info text,
37 CONSTRAINT {$CFG->prefix}backup_ids_uk UNIQUE (backup_code, table_name, old_id))");
41 if ($oldversion < 2006042801) {
42 table_column('backup_log', 'time', 'time', 'integer', '', '', '0');
43 table_column('backup_log', 'laststarttime', 'laststarttime', 'integer', '', '', '0');
44 table_column('backup_log', 'courseid', 'courseid', 'integer', '', '', '0');
46 table_column('backup_courses', 'lastendtime', 'lastendtime', 'integer', '', '', '0');
47 table_column('backup_courses', 'laststarttime', 'laststarttime', 'integer', '', '', '0');
48 table_column('backup_courses', 'courseid', 'courseid', 'integer', '', '', '0');
49 table_column('backup_courses', 'nextstarttime', 'nextstarttime', 'integer', '', '', '0');
52 ////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
54 //Finally, return result
55 return $result;