0008070: check index lengths / message cache
[tine20] / tine20 / Felamimail / Setup / Update / Release8.php
1 <?php
2 /**
3  * Tine 2.0
4  *
5  * @package     Felamimail
6  * @subpackage  Setup
7  * @license     http://www.gnu.org/licenses/agpl.html AGPL3
8  * @copyright   Copyright (c) 2013-2014 Metaways Infosystems GmbH (http://www.metaways.de)
9  * @author      Philipp Schüle <p.schuele@metaways.de>
10  */
11 class Felamimail_Setup_Update_Release8 extends Setup_Update_Abstract
12 {
13     /**
14      * add imap_lastmodseq and supports_condstore
15      * 
16      * @see 0003730: support CONDSTORE extension for quick flag sync
17      */
18     public function update_0()
19     {
20         $this->validateTableVersion('felamimail_folder', 12);
21         
22         $declaration = new Setup_Backend_Schema_Field_Xml('
23             <field>
24                 <name>imap_lastmodseq</name>
25                 <type>integer</type>
26                 <length>64</length>
27             </field>');
28         $this->_backend->addCol('felamimail_folder', $declaration);
29         
30         $declaration = new Setup_Backend_Schema_Field_Xml('
31             <field>
32                 <name>supports_condstore</name>
33                 <type>boolean</type>
34                 <default>null</default>
35             </field>');
36         $this->_backend->addCol('felamimail_folder', $declaration);
37         
38         $this->setTableVersion('felamimail_folder', 13);
39         
40         $this->setApplicationVersion('Felamimail', '8.1');
41     }
42     
43     /**
44      * add conjunction field to sieve rule to allow "anyof"-conjunction
45      */
46     public function update_1()
47     {
48         $declaration = new Setup_Backend_Schema_Field_Xml('<field>
49             <name>conjunction</name>
50             <type>text</type>
51             <length>40</length>
52             <notnull>true</notnull>
53             <default>allof</default>
54         </field>');
55         
56         $this->_backend->addCol('felamimail_sieve_rule', $declaration);
57         
58         $this->setTableVersion('felamimail_sieve_rule', 3);
59         $this->setApplicationVersion('Felamimail', '8.2');
60     }
61     
62     
63     /**
64      * update to 8.3
65      * - update 256 char fields
66      * 
67      * @see 0008070: check index lengths
68      */
69     public function update_2()
70     {
71         $columns = array("felamimail_account" => array(
72                             "name" => "",
73                             "host" => "",
74                             "email" => "",
75                             "from" => "",
76                             "organization" => "",
77                             "sent_folder" => "",
78                             "trash_folder" => "",
79                             "drafts_folder" => "",
80                             "templates_folder" => "",
81                             "ns_personal" => "",
82                             "ns_other" => "",
83                             "ns_shared" => "",
84                             "smtp_hostname" => "",
85                             "sieve_hostname" => ""
86                             ),
87                         "felamimail_folder" => array(
88                             "localname" => "",
89                             "parent" => ""
90                             ),
91             // NOTE: we do not update the current message cache structure as this could
92             // lead to problems for large installations with lots of messages in the cache
93             // TODO: find out cache size, no problems with smaller sizes
94             // TODO: find out ways to improve alter table speed for big caches
95             
96 //                         "felamimail_cache_message" => array(
97 //                             "content_type" => "",
98 //                             "body_content_type" => "",
99 //                             "from_email" => "",
100 //                             "from_name" => "",
101 //                             "sender" => ""
102 //                             ),
103 //                         "felamimail_cache_message_to" => array(
104 //                             "name" => "",
105 //                             "email" => ""
106 //                             ),
107 //                         "felamimail_cache_message_cc" => array(
108 //                             "name" => "",
109 //                             "email" => ""
110 //                             ),
111 //                         "felamimail_cache_message_bcc" => array(
112 //                             "name" => "",
113 //                             "email" => ""
114 //                             ),
115
116                         "felamimail_sieve_rule" => array(
117                             "action_type" => "",
118                             "action_argument" => ""
119                             ),
120                         "felamimail_sieve_vacation" => array(
121                             "subject" => "",
122                             "from" => "",
123                             "mime" => ""
124                             )
125                         );
126         
127         $this->truncateTextColumn($columns, 255);
128         $this->setTableVersion('felamimail_account', 20);
129         $this->setTableVersion('felamimail_folder', 14);
130 //         $this->setTableVersion('felamimail_cache_message', 9);
131 //         $this->setTableVersion('felamimail_cache_message_to', 2);
132 //         $this->setTableVersion('felamimail_cache_message_cc', 2);
133 //         $this->setTableVersion('felamimail_cache_message_bcc', 2);
134         $this->setTableVersion('felamimail_sieve_rule', 3);
135         $this->setTableVersion('felamimail_sieve_vacation', 3);
136         $this->setApplicationVersion('Felamimail', '8.3');
137     }
138 }