0013390: container_id update script problems
authorPaul Mehrer <p.mehrer@metaways.de>
Mon, 14 Aug 2017 10:15:39 +0000 (12:15 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 14 Aug 2017 11:14:34 +0000 (13:14 +0200)
* don't update other application versions from Tinebase
* also fixes some table versions

https://forge.tine20.org/view.php?id=13390

Change-Id: Ie85231da15b3310e0c37c1303ed54687aab19386
Reviewed-on: http://gerrit.tine20.com/customers/5461
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
12 files changed:
tine20/Addressbook/Setup/Update/Release10.php
tine20/Addressbook/Setup/setup.xml
tine20/Calendar/Setup/Update/Release10.php
tine20/Crm/Setup/Update/Release10.php
tine20/Events/Setup/Update/Release10.php
tine20/Projects/Setup/Update/Release10.php
tine20/Sales/Setup/Update/Release10.php
tine20/Sales/Setup/setup.xml
tine20/SimpleFAQ/Setup/Update/Release10.php [new file with mode: 0644]
tine20/Tasks/Setup/Update/Release10.php
tine20/Timetracker/Setup/Update/Release10.php
tine20/Tinebase/Setup/Update/Release10.php

index 155c1a3..e054292 100644 (file)
@@ -107,6 +107,20 @@ class Addressbook_Setup_Update_Release10 extends Setup_Update_Abstract
 
     public function update_5()
     {
+        if ($this->getTableVersion('addressbook') < 25) {
+            $this->setTableVersion('addressbook', 25);
+        }
+        if ($this->getTableVersion('addressbook_lists') < 6) {
+            $this->setTableVersion('addressbook_lists', 6);
+        }
         $this->setApplicationVersion('Addressbook', '10.6');
     }
+
+    public function update_6()
+    {
+        if ($this->getTableVersion('addressbook_lists') == 25) {
+            $this->setTableVersion('addressbook_lists', 6);
+        }
+        $this->setApplicationVersion('Addressbook', '10.7');
+    }
 }
index a1f90a7..3ab483b 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <application>
     <name>Addressbook</name>
-    <version>10.6</version>
+    <version>10.7</version>
     <order>10</order>
     <depends>
         <application>Admin</application>
index 8aa430b..e2e7880 100644 (file)
@@ -185,6 +185,15 @@ class Calendar_Setup_Update_Release10 extends Setup_Update_Abstract
 
     public function update_7()
     {
+        if ($this->getTableVersion('cal_events') < 14) {
+            $this->setTableVersion('cal_events', 14);
+        }
+        if ($this->getTableVersion('cal_attendee') < 6) {
+            $this->setTableVersion('cal_attendee', 6);
+        }
+        if ($this->getTableVersion('cal_resources') < 6) {
+            $this->setTableVersion('cal_resources', 6);
+        }
         $this->setApplicationVersion('Calendar', '10.8');
     }
 }
index ec71e94..2b07591 100644 (file)
@@ -35,6 +35,9 @@ class Crm_Setup_Update_Release10 extends Setup_Update_Abstract
 
     public function update_1()
     {
+        if ($this->getTableVersion('metacrm_lead') < 10) {
+            $this->setTableVersion('metacrm_lead', 10);
+        }
         $this->setApplicationVersion('Crm', '10.2');
     }
 }
index b7ef90e..ee19324 100644 (file)
@@ -36,6 +36,9 @@ class Events_Setup_Update_Release10 extends Setup_Update_Abstract
 
     public function update_1()
     {
+        if ($this->getTableVersion('events_event') < 3) {
+            $this->setTableVersion('events_event', 3);
+        }
         $this->setApplicationVersion('Events', '10.2');
     }
 }
index 7744a2c..d25984d 100644 (file)
@@ -35,6 +35,9 @@ class Projects_Setup_Update_Release10 extends Setup_Update_Abstract
 
     public function update_1()
     {
+        if ($this->getTableVersion('projects_project') < 4) {
+            $this->setTableVersion('projects_project', 4);
+        }
         $this->setApplicationVersion('Projects', '10.2');
     }
 }
index 8e8163c..517fa17 100644 (file)
@@ -209,4 +209,15 @@ class Sales_Setup_Update_Release10 extends Setup_Update_Abstract
         $this->setTableVersion('sales_orderconf', 2);
         $this->setApplicationVersion('Sales', '10.9');
     }
+
+    /**
+     * update to 10.10
+     */
+    public function update_9()
+    {
+        if ($this->getTableVersion('sales_contracts') < 10) {
+            $this->setTableVersion('sales_contracts', 10);
+        }
+        $this->setApplicationVersion('Sales', '10.10');
+    }
 }
index 0d1b8c2..59218ba 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <application>
     <name>Sales</name>
-    <version>10.9</version>
+    <version>10.10</version>
     <order>50</order>
     <status>enabled</status>
     <tables>
diff --git a/tine20/SimpleFAQ/Setup/Update/Release10.php b/tine20/SimpleFAQ/Setup/Update/Release10.php
new file mode 100644 (file)
index 0000000..b6a3f87
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+/**
+ * Tine 2.0
+ *
+ * @package     SimpleFAQ
+ * @subpackage  Setup
+ * @license     http://www.gnu.org/licenses/agpl.html AGPL3
+ * @copyright   Copyright (c) 2017 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @author      Paul Mehrer <p.mehrer@metaways.de>
+ */
+class SimpleFAQ_Setup_Update_Release10 extends Setup_Update_Abstract
+{
+    /**
+     * update to 10.1
+     *
+     * @return void
+     */
+    public function update_0()
+    {
+        if ($this->getTableVersion('simple_faq') < 3) {
+            $this->setTableVersion('simple_faq', 3);
+        }
+        $this->setApplicationVersion('SimpleFAQ', '10.1');
+    }
+}
index d51e60e..13b4f6d 100644 (file)
@@ -35,6 +35,9 @@ class Tasks_Setup_Update_Release10 extends Setup_Update_Abstract
 
     public function update_1()
     {
+        if ($this->getTableVersion('tasks') < 10) {
+            $this->setTableVersion('tasks', 10);
+        }
         $this->setApplicationVersion('Tasks', '10.2');
     }
 }
index 51042e2..365e1c6 100644 (file)
@@ -69,6 +69,9 @@ class Timetracker_Setup_Update_Release10 extends Setup_Update_Abstract
 
     public function update_2()
     {
+        if ($this->getTableVersion('timetracker_timeaccount') < 12) {
+            $this->setTableVersion('timetracker_timeaccount', 12);
+        }
         $this->setApplicationVersion('Timetracker', '10.3');
     }
 
index 54f379c..a570a11 100644 (file)
@@ -1328,194 +1328,137 @@ class Tinebase_Setup_Update_Release10 extends Setup_Update_Abstract
             } catch (Exception $e) {}
         }
 
+        if ($this->getTableVersion('container') < 13) {
+            $this->_backend->alterCol('container', new Setup_Backend_Schema_Field_Xml('<field>
+                        <name>id</name>
+                        <type>text</type>
+                        <length>40</length>
+                        <notnull>true</notnull>
+                    </field>'));
+            $this->setTableVersion('container', 13);
+        }
 
-        if (version_compare($this->getApplicationVersion('Tinebase'), '10.32') < 0 ) {
-            if ($this->getTableVersion('container') < 13) {
-                $this->_backend->alterCol('container', new Setup_Backend_Schema_Field_Xml('<field>
-                            <name>id</name>
-                            <type>text</type>
-                            <length>40</length>
-                            <notnull>true</notnull>
-                        </field>'));
-                $this->setTableVersion('container', 13);
-            }
-
-            if ($this->getTableVersion('container_acl') < 4) {
-                $this->_backend->alterCol('container_acl', new Setup_Backend_Schema_Field_Xml('<field>
-                            <name>container_id</name>
-                            <type>text</type>
-                            <length>40</length>
-                            <notnull>true</notnull>
-                        </field>'));
-                $this->setTableVersion('container_acl', 4);
-            }
+        if ($this->getTableVersion('container_acl') < 4) {
+            $this->_backend->alterCol('container_acl', new Setup_Backend_Schema_Field_Xml('<field>
+                        <name>container_id</name>
+                        <type>text</type>
+                        <length>40</length>
+                        <notnull>true</notnull>
+                    </field>'));
+            $this->setTableVersion('container_acl', 4);
+        }
 
-            if ($this->getTableVersion('container_content') < 3) {
-                $this->_backend->alterCol('container_content', new Setup_Backend_Schema_Field_Xml('<field>
-                            <name>container_id</name>
-                            <type>text</type>
-                            <length>40</length>
-                            <notnull>true</notnull>
-                        </field>'));
-                $this->setTableVersion('container_content', 3);
-            }
+        if ($this->getTableVersion('container_content') < 3) {
+            $this->_backend->alterCol('container_content', new Setup_Backend_Schema_Field_Xml('<field>
+                        <name>container_id</name>
+                        <type>text</type>
+                        <length>40</length>
+                        <notnull>true</notnull>
+                    </field>'));
+            $this->setTableVersion('container_content', 3);
         }
 
-        if (version_compare($this->getApplicationVersion('Addressbook'), '10.6') < 0 ) {
-            if ($this->getTableVersion('addressbook') < 25) {
-                $this->_backend->alterCol('addressbook', new Setup_Backend_Schema_Field_Xml('<field>
-                    <name>container_id</name>
-                    <type>text</type>
-                    <length>40</length>
-                    <notnull>false</notnull>
-                </field>'));
-                $this->setTableVersion('addressbook', 25);
-            }
 
-            if ($this->getTableVersion('addressbook_lists') < 6) {
-                $this->_backend->alterCol('addressbook_lists', new Setup_Backend_Schema_Field_Xml('<field>
-                    <name>container_id</name>
-                    <type>text</type>
-                    <length>40</length>
-                    <notnull>false</notnull>
-                </field>'));
-                $this->setTableVersion('addressbook_lists', 25);
-            }
+        $this->_backend->alterCol('addressbook', new Setup_Backend_Schema_Field_Xml('<field>
+            <name>container_id</name>
+            <type>text</type>
+            <length>40</length>
+            <notnull>false</notnull>
+        </field>'));
 
-            $this->setApplicationVersion('Addressbook', '10.6');
-        }
+        $this->_backend->alterCol('addressbook_lists', new Setup_Backend_Schema_Field_Xml('<field>
+            <name>container_id</name>
+            <type>text</type>
+            <length>40</length>
+            <notnull>false</notnull>
+        </field>'));
 
-        if (Tinebase_Application::getInstance()->isInstalled('Calendar') &&
-                version_compare($this->getApplicationVersion('Calendar'), '10.8') < 0 ) {
-            if ($this->getTableVersion('cal_events') < 14) {
-                $this->_backend->alterCol('cal_events', new Setup_Backend_Schema_Field_Xml('<field>
-                    <name>container_id</name>
-                    <type>text</type>
-                    <length>40</length>
-                    <notnull>false</notnull>
-                </field>'));
-                $this->setTableVersion('cal_events', 14);
-            }
 
-            if ($this->getTableVersion('cal_attendee') < 6) {
-                $this->_backend->alterCol('cal_attendee', new Setup_Backend_Schema_Field_Xml('<field>
-                    <name>displaycontainer_id</name>
-                    <type>text</type>
-                    <length>40</length>
-                    <notnull>false</notnull>
-                </field>'));
-                $this->setTableVersion('cal_attendee', 6);
-            }
+        if (Tinebase_Application::getInstance()->isInstalled('Calendar')) {
+            $this->_backend->alterCol('cal_events', new Setup_Backend_Schema_Field_Xml('<field>
+                <name>container_id</name>
+                <type>text</type>
+                <length>40</length>
+                <notnull>false</notnull>
+            </field>'));
 
-            if ($this->getTableVersion('cal_resources') < 6) {
-                $this->_backend->alterCol('cal_resources', new Setup_Backend_Schema_Field_Xml('<field>
-                    <name>container_id</name>
-                    <type>text</type>
-                    <length>40</length>
-                    <notnull>false</notnull>
-                </field>'));
-                $this->setTableVersion('cal_resources', 6);
-            }
+            $this->_backend->alterCol('cal_attendee', new Setup_Backend_Schema_Field_Xml('<field>
+                <name>displaycontainer_id</name>
+                <type>text</type>
+                <length>40</length>
+                <notnull>false</notnull>
+            </field>'));
 
-            $this->setApplicationVersion('Calendar', '10.8');
+            $this->_backend->alterCol('cal_resources', new Setup_Backend_Schema_Field_Xml('<field>
+                <name>container_id</name>
+                <type>text</type>
+                <length>40</length>
+                <notnull>false</notnull>
+            </field>'));
         }
 
-        if (Tinebase_Application::getInstance()->isInstalled('Crm') &&
-            version_compare($this->getApplicationVersion('Crm'), '10.2') < 0 ) {
-            if ($this->getTableVersion('metacrm_lead') < 10) {
-                $this->_backend->alterCol('metacrm_lead', new Setup_Backend_Schema_Field_Xml('<field>
-                    <name>container_id</name>
-                    <type>text</type>
-                    <length>40</length>
-                    <notnull>false</notnull>
-                </field>'));
-                $this->setTableVersion('metacrm_lead', 10);
-            }
-            $this->setApplicationVersion('Crm', '10.2');
+        if (Tinebase_Application::getInstance()->isInstalled('Crm')) {
+            $this->_backend->alterCol('metacrm_lead', new Setup_Backend_Schema_Field_Xml('<field>
+                <name>container_id</name>
+                <type>text</type>
+                <length>40</length>
+                <notnull>false</notnull>
+            </field>'));
         }
 
-        if (Tinebase_Application::getInstance()->isInstalled('Events') &&
-            version_compare($this->getApplicationVersion('Events'), '10.2') < 0 ) {
-            if ($this->getTableVersion('events_event') < 3) {
-                $this->_backend->alterCol('events_event', new Setup_Backend_Schema_Field_Xml('<field>
-                    <name>container_id</name>
-                    <type>text</type>
-                    <length>40</length>
-                    <notnull>false</notnull>
-                </field>'));
-                $this->setTableVersion('events_event', 3);
-            }
-            $this->setApplicationVersion('Events', '10.2');
+        if (Tinebase_Application::getInstance()->isInstalled('Events')) {
+            $this->_backend->alterCol('events_event', new Setup_Backend_Schema_Field_Xml('<field>
+                <name>container_id</name>
+                <type>text</type>
+                <length>40</length>
+                <notnull>false</notnull>
+            </field>'));
         }
 
-        if (Tinebase_Application::getInstance()->isInstalled('Projects') &&
-            version_compare($this->getApplicationVersion('Projects'), '10.2') < 0 ) {
-            if ($this->getTableVersion('projects_project') < 4) {
-                $this->_backend->alterCol('projects_project', new Setup_Backend_Schema_Field_Xml('<field>
-                    <name>container_id</name>
-                    <type>text</type>
-                    <length>40</length>
-                    <notnull>false</notnull>
-                </field>'));
-                $this->setTableVersion('projects_project', 4);
-            }
-            $this->setApplicationVersion('Projects', '10.2');
+        if (Tinebase_Application::getInstance()->isInstalled('Projects')) {
+            $this->_backend->alterCol('projects_project', new Setup_Backend_Schema_Field_Xml('<field>
+                <name>container_id</name>
+                <type>text</type>
+                <length>40</length>
+                <notnull>false</notnull>
+            </field>'));
         }
 
-        if (Tinebase_Application::getInstance()->isInstalled('Sales') &&
-            version_compare($this->getApplicationVersion('Sales'), '10.9') < 0 ) {
-            if ($this->getTableVersion('sales_contracts') < 10) {
-                $this->_backend->alterCol('sales_contracts', new Setup_Backend_Schema_Field_Xml('<field>
-                    <name>container_id</name>
-                    <type>text</type>
-                    <length>40</length>
-                    <notnull>true</notnull>
-                </field>'));
-                $this->setTableVersion('sales_contracts', 10);
-            }
-            $this->setApplicationVersion('Sales', '10.9');
+        if (Tinebase_Application::getInstance()->isInstalled('Sales')) {
+            $this->_backend->alterCol('sales_contracts', new Setup_Backend_Schema_Field_Xml('<field>
+                <name>container_id</name>
+                <type>text</type>
+                <length>40</length>
+                <notnull>true</notnull>
+            </field>'));
         }
 
-        if (Tinebase_Application::getInstance()->isInstalled('SimpleFAQ') &&
-            version_compare($this->getApplicationVersion('SimpleFAQ'), '10.1') < 0 ) {
-            if ($this->getTableVersion('simple_faq') < 3) {
-                $this->_backend->alterCol('simple_faq', new Setup_Backend_Schema_Field_Xml('<field>
-                    <name>container_id</name>
-                    <type>text</type>
-                    <length>40</length>
-                    <notnull>false</notnull>
-                </field>'));
-                $this->setTableVersion('simple_faq', 3);
-            }
-            $this->setApplicationVersion('SimpleFAQ', '10.1');
+        if (Tinebase_Application::getInstance()->isInstalled('SimpleFAQ')) {
+            $this->_backend->alterCol('simple_faq', new Setup_Backend_Schema_Field_Xml('<field>
+                <name>container_id</name>
+                <type>text</type>
+                <length>40</length>
+                <notnull>false</notnull>
+            </field>'));
         }
 
-        if (Tinebase_Application::getInstance()->isInstalled('Tasks') &&
-            version_compare($this->getApplicationVersion('Tasks'), '10.2') < 0 ) {
-            if ($this->getTableVersion('tasks') < 10) {
-                $this->_backend->alterCol('tasks', new Setup_Backend_Schema_Field_Xml('<field>
-                    <name>container_id</name>
-                    <type>text</type>
-                    <length>40</length>
-                    <notnull>false</notnull>
-                </field>'));
-                $this->setTableVersion('tasks', 10);
-            }
-            $this->setApplicationVersion('Tasks', '10.2');
+        if (Tinebase_Application::getInstance()->isInstalled('Tasks')) {
+            $this->_backend->alterCol('tasks', new Setup_Backend_Schema_Field_Xml('<field>
+                <name>container_id</name>
+                <type>text</type>
+                <length>40</length>
+                <notnull>false</notnull>
+            </field>'));
         }
 
-        if (Tinebase_Application::getInstance()->isInstalled('Timetracker') &&
-            version_compare($this->getApplicationVersion('Timetracker'), '10.3') < 0 ) {
-            if ($this->getTableVersion('timetracker_timeaccount') < 12) {
-                $this->_backend->alterCol('timetracker_timeaccount', new Setup_Backend_Schema_Field_Xml('<field>
-                    <name>container_id</name>
-                    <type>text</type>
-                    <length>40</length>
-                    <notnull>false</notnull>
-                </field>'));
-                $this->setTableVersion('timetracker_timeaccount', 12);
-            }
-            $this->setApplicationVersion('Timetracker', '10.3');
+        if (Tinebase_Application::getInstance()->isInstalled('Timetracker')) {
+            $this->_backend->alterCol('timetracker_timeaccount', new Setup_Backend_Schema_Field_Xml('<field>
+                <name>container_id</name>
+                <type>text</type>
+                <length>40</length>
+                <notnull>false</notnull>
+            </field>'));
+
         }
 
         $this->_backend->addForeignKey('container_content', new Setup_Backend_Schema_Index_Xml('<index>