Sales - add full text index to orderconf table
[tine20] / tine20 / Sales / Setup / Update / Release10.php
1 <?php
2 /**
3  * Tine 2.0
4  *
5  * @package     Sales
6  * @subpackage  Setup
7  * @license     http://www.gnu.org/licenses/agpl.html AGPL3
8  * @copyright   Copyright (c) 2015-2016 Metaways Infosystems GmbH (http://www.metaways.de)
9  * @author      Philipp Schüle <p.schuele@metaways.de>
10  */
11 class Sales_Setup_Update_Release10 extends Setup_Update_Abstract
12 {
13     /**
14      * update to 10.1
15      * - 0012358: purchase invoice description column too short
16      */
17     public function update_0()
18     {
19         if ($this->getTableVersion('sales_purchase_invoices') < 4) {
20             $declaration = new Setup_Backend_Schema_Field_Xml('
21                <field>
22                     <name>description</name>
23                     <type>text</type>
24                 </field>
25         ');
26             $this->_backend->alterCol('sales_purchase_invoices', $declaration);
27             $this->setTableVersion('sales_purchase_invoices', 4);
28         }
29         $this->setApplicationVersion('Sales', '10.1');
30     }
31
32     /**
33      * update to 10.2
34      *
35      * Add fulltext index for description field of sales_contracts
36      */
37     public function update_1()
38     {
39         $declaration = new Setup_Backend_Schema_Index_Xml('
40             <index>
41                 <name>description</name>
42                 <fulltext>true</fulltext>
43                 <field>
44                     <name>description</name>
45                 </field>
46             </index>
47         ');
48
49         $this->_backend->addIndex('sales_contracts', $declaration);
50
51         $this->setTableVersion('sales_contracts', 9);
52         $this->setApplicationVersion('Sales', '10.2');
53     }
54
55     /**
56      * update to 10.3
57      *
58      * Add fulltext index for description field of sales_products
59      */
60     public function update_2()
61     {
62         $declaration = new Setup_Backend_Schema_Index_Xml('
63             <index>
64                 <name>description</name>
65                 <fulltext>true</fulltext>
66                 <field>
67                     <name>description</name>
68                 </field>
69             </index>
70         ');
71
72         $this->_backend->addIndex('sales_products', $declaration);
73
74         $this->setTableVersion('sales_products', 7);
75         $this->setApplicationVersion('Sales', '10.3');
76     }
77
78     /**
79      * update to 10.4
80      *
81      * Add fulltext index for description field of sales_customers
82      */
83     public function update_3()
84     {
85         $declaration = new Setup_Backend_Schema_Index_Xml('
86             <index>
87                 <name>description</name>
88                 <fulltext>true</fulltext>
89                 <field>
90                     <name>description</name>
91                 </field>
92             </index>
93         ');
94
95         $this->_backend->addIndex('sales_customers', $declaration);
96
97         $this->setTableVersion('sales_customers', 2);
98         $this->setApplicationVersion('Sales', '10.4');
99     }
100
101     /**
102      * update to 10.5
103      *
104      * Add fulltext index for description field of sales_suppliers
105      */
106     public function update_4()
107     {
108         $declaration = new Setup_Backend_Schema_Index_Xml('
109             <index>
110                 <name>description</name>
111                 <fulltext>true</fulltext>
112                 <field>
113                     <name>description</name>
114                 </field>
115             </index>
116         ');
117
118         $this->_backend->addIndex('sales_suppliers', $declaration);
119
120         $this->setTableVersion('sales_suppliers', 2);
121         $this->setApplicationVersion('Sales', '10.5');
122     }
123
124     /**
125      * update to 10.6
126      *
127      * Add fulltext index for description field of sales_purchase_invoices
128      */
129     public function update_5()
130     {
131         $declaration = new Setup_Backend_Schema_Index_Xml('
132             <index>
133                 <name>description</name>
134                 <fulltext>true</fulltext>
135                 <field>
136                     <name>description</name>
137                 </field>
138             </index>
139         ');
140
141         $this->_backend->addIndex('sales_purchase_invoices', $declaration);
142
143         $this->setTableVersion('sales_purchase_invoices', 5);
144         $this->setApplicationVersion('Sales', '10.6');
145     }
146
147     /**
148      * update to 10.7
149      *
150      * Add fulltext index for description field of sales_sales_invoices
151      */
152     public function update_6()
153     {
154         $declaration = new Setup_Backend_Schema_Index_Xml('
155             <index>
156                 <name>description</name>
157                 <fulltext>true</fulltext>
158                 <field>
159                     <name>description</name>
160                 </field>
161             </index>
162         ');
163
164         $this->_backend->addIndex('sales_sales_invoices', $declaration);
165
166         $this->setTableVersion('sales_sales_invoices', 7);
167         $this->setApplicationVersion('Sales', '10.7');
168     }
169     
170     /**
171      * update to 10.8
172      *
173      * Add fulltext index for description field of sales_offers
174      */
175     public function update_7()
176     {
177         $declaration = new Setup_Backend_Schema_Index_Xml('
178             <index>
179                 <name>description</name>
180                 <fulltext>true</fulltext>
181                 <field>
182                     <name>description</name>
183                 </field>
184             </index>
185         ');
186
187         $this->_backend->addIndex('sales_offers', $declaration);
188
189         $this->setTableVersion('sales_offers', 2);
190         $this->setApplicationVersion('Sales', '10.8');
191     }
192
193     /**
194      * update to 10.9
195      *
196      * Add fulltext index for description field of sales_offers
197      */
198     public function update_8()
199     {
200         $declaration = new Setup_Backend_Schema_Index_Xml('<index>
201                 <name>description</name>
202                 <fulltext>true</fulltext>
203                 <field>
204                 <name>description</name>
205                 </field>
206             </index>');
207         $this->_backend->addIndex('sales_orderconf', $declaration);
208
209         $this->setTableVersion('sales_orderconf', 2);
210         $this->setApplicationVersion('Sales', '10.9');
211     }
212 }