[5618] | 1 | <?php |
---|
| 2 | /**************************************************************************\ |
---|
| 3 | * ExpressoLivre - Setup * |
---|
| 4 | * http://www.expressolivre.org * |
---|
| 5 | * -------------------------------------------- * |
---|
| 6 | * This program is free software; you can redistribute it and/or modify it * |
---|
| 7 | * under the terms of the GNU General Public License as published by the * |
---|
| 8 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
| 9 | * option) any later version. * |
---|
| 10 | \**************************************************************************/ |
---|
[5647] | 11 | |
---|
[5618] | 12 | $test[] = '1.000'; |
---|
| 13 | function expressoCalendar_upgrade1_000() { |
---|
| 14 | |
---|
| 15 | $oProc = $GLOBALS['phpgw_setup']->oProc; |
---|
| 16 | |
---|
[5651] | 17 | $oProc->query("ALTER TABLE calendar_participant ADD COLUMN acl character varying(10) not null DEFAULT 'r' "); |
---|
| 18 | |
---|
| 19 | $oProc->query("ALTER TABLE calendar_participant ADD COLUMN receive_notification smallint not null DEFAULT 1 "); |
---|
[5618] | 20 | $oProc->query('ALTER TABLE calendar_participant RENAME COLUMN delegated_to TO delegated_from '); |
---|
[5651] | 21 | |
---|
| 22 | $oProc->query("UPDATE calendar_participant SET acl = 'rowi' where is_organizer = 1 "); |
---|
[5618] | 23 | |
---|
[5645] | 24 | $oProc->query('ALTER TABLE calendar_object ALTER COLUMN range_start TYPE bigint USING (date_part(\'epoch\',(cast(range_start as timestamp)))::bigint) * 1000'); |
---|
| 25 | $oProc->query('ALTER TABLE calendar_object ALTER COLUMN range_end TYPE bigint USING (date_part(\'epoch\',(cast(range_end as timestamp)))::bigint) * 1000'); |
---|
[5618] | 26 | |
---|
[5645] | 27 | $oProc->query('ALTER TABLE calendar_alarm ALTER COLUMN range_end TYPE bigint USING (date_part(\'epoch\',(cast(range_end as timestamp)))::bigint) * 1000'); |
---|
| 28 | $oProc->query('ALTER TABLE calendar_alarm ALTER COLUMN range_start TYPE bigint USING (date_part(\'epoch\',(cast(range_start as timestamp)))::bigint) * 1000'); |
---|
[5618] | 29 | |
---|
[5651] | 30 | $oProc->query("ALTER TABLE attachment ADD COLUMN owner integer"); |
---|
[5618] | 31 | |
---|
| 32 | $GLOBALS['setup_info']['expressoCalendar']['currentver'] = '1.001'; |
---|
| 33 | return $GLOBALS['setup_info']['expressoCalendar']['currentver']; |
---|
| 34 | } |
---|
[5715] | 35 | |
---|
| 36 | $test[] = '1.001'; |
---|
| 37 | function expressoCalendar_upgrade1_001() { |
---|
| 38 | |
---|
| 39 | $oProc = $GLOBALS['phpgw_setup']->oProc; |
---|
| 40 | |
---|
| 41 | $oProc->query("ALTER TABLE calendar_repeat ADD COLUMN dtstart bigint"); |
---|
| 42 | $oProc->query('ALTER TABLE calendar_repeat ALTER COLUMN until DROP NOT NULL'); |
---|
| 43 | |
---|
| 44 | $oProc->CreateTable('calendar_repeat_occurrence', array( |
---|
| 45 | 'fd' => array( |
---|
| 46 | 'id' => array( 'type' => 'auto', 'nullable' => False), |
---|
| 47 | 'occurrence' => array( 'type' => 'bigint','precision' => '16', 'nullable' => False), |
---|
| 48 | 'repeat_id' => array( 'type' => 'int', 'precision' => '8', 'nullable' => False) |
---|
| 49 | ), |
---|
| 50 | |
---|
| 51 | 'pk' => array('id'), |
---|
| 52 | 'fk' => array('repeat_id'), |
---|
| 53 | 'ix' => array(), |
---|
| 54 | 'uc' => array() |
---|
| 55 | ) |
---|
| 56 | ); |
---|
| 57 | |
---|
| 58 | $oProc->CreateTable('calendar_repeat_ranges', array( |
---|
| 59 | 'fd' => array( |
---|
| 60 | 'id' => array( 'type' => 'auto', 'nullable' => False), |
---|
| 61 | 'range_start' => array( 'type' => 'bigint','precision' => '16', 'nullable' => False), |
---|
| 62 | 'range_end' => array( 'type' => 'bigint', 'precision' => '16', 'nullable' => False), |
---|
| 63 | 'user_info_id' => array( 'type' => 'bigint', 'precision' => '16', 'nullable' => False) |
---|
| 64 | ), |
---|
| 65 | 'pk' => array('id'), |
---|
| 66 | 'fk' => array(), |
---|
| 67 | 'ix' => array(), |
---|
| 68 | 'uc' => array() |
---|
| 69 | ) |
---|
| 70 | ); |
---|
| 71 | |
---|
[5741] | 72 | $oProc->query("ALTER TABLE calendar_participant ADD COLUMN receive_notification smallint not null DEFAULT 1 "); |
---|
[5715] | 73 | |
---|
| 74 | $GLOBALS['setup_info']['expressoCalendar']['currentver'] = '1.002'; |
---|
| 75 | return $GLOBALS['setup_info']['expressoCalendar']['currentver']; |
---|
[5804] | 76 | }; |
---|
[5741] | 77 | |
---|
| 78 | $test[] = '1.002'; |
---|
| 79 | function expressoCalendar_upgrade1_002() { |
---|
| 80 | |
---|
[5746] | 81 | $oProc = $GLOBALS['phpgw_setup']->oProc; |
---|
[5741] | 82 | |
---|
[5746] | 83 | $oProc->query("ALTER TABLE calendar_repeat_occurrence ADD COLUMN exception smallint DEFAULT 0"); |
---|
[5741] | 84 | |
---|
[5746] | 85 | $GLOBALS['setup_info']['expressoCalendar']['currentver'] = '1.003'; |
---|
| 86 | return $GLOBALS['setup_info']['expressoCalendar']['currentver']; |
---|
[5804] | 87 | }; |
---|
| 88 | |
---|
| 89 | $test[] = '1.003'; |
---|
| 90 | function expressoCalendar_upgrade1_003() { |
---|
| 91 | $GLOBALS['setup_info']['expressoCalendar']['currentver'] = '1.004'; |
---|
| 92 | return $GLOBALS['setup_info']['expressoCalendar']['currentver']; |
---|
| 93 | }; |
---|
[5953] | 94 | |
---|
| 95 | $test[] = '1.004'; |
---|
| 96 | function expressoCalendar_upgrade1_004() { |
---|
| 97 | $oProc = $GLOBALS['phpgw_setup']->oProc; |
---|
[5994] | 98 | $oProc->query("ALTER TABLE calendar_repeat_occurrence ALTER COLUMN exception SET default 0"); |
---|
[5953] | 99 | |
---|
| 100 | $GLOBALS['setup_info']['expressoCalendar']['currentver'] = '1.005'; |
---|
| 101 | return $GLOBALS['setup_info']['expressoCalendar']['currentver']; |
---|
| 102 | }; |
---|
[5804] | 103 | |
---|
[6111] | 104 | $test[] = '1.005'; |
---|
| 105 | function expressoCalendar_upgrade1_005() { |
---|
| 106 | $oProc = $GLOBALS['phpgw_setup']->oProc; |
---|
| 107 | $oProc->query("ALTER TABLE calendar_alarm ADD COLUMN alarm_offset bigint;"); |
---|
| 108 | $oProc->query("UPDATE calendar_alarm SET alarm_offset = obj.range_start - calendar_alarm.range_start FROM calendar_object as obj WHERE obj.id = object_id;"); |
---|
| 109 | $oProc->query("ALTER TABLE calendar_alarm DROP COLUMN range_start;"); |
---|
| 110 | $oProc->query("ALTER TABLE calendar_alarm DROP COLUMN range_end;"); |
---|
| 111 | $GLOBALS['setup_info']['expressoCalendar']['currentver'] = '1.006'; |
---|
| 112 | return $GLOBALS['setup_info']['expressoCalendar']['currentver']; |
---|
| 113 | }; |
---|
[6255] | 114 | |
---|
| 115 | |
---|
| 116 | $test[] = '1.006'; |
---|
| 117 | function expressoCalendar_upgrade1_006() { |
---|
| 118 | $GLOBALS['setup_info']['expressoCalendar']['currentver'] = '1.007'; |
---|
| 119 | return $GLOBALS['setup_info']['expressoCalendar']['currentver']; |
---|
| 120 | }; |
---|
[5804] | 121 | |
---|
[5618] | 122 | ?> |
---|