Allow location to be NULL if empty
authorMichael Spahn <m.spahn@metaways.de>
Fri, 24 Aug 2012 07:10:24 +0000 (09:10 +0200)
committerMichael Spahn <m.spahn@metaways.de>
Thu, 4 Oct 2012 13:54:56 +0000 (15:54 +0200)
This caused an error if the field was left empty.

Change-Id: If5333527f0f92ac96abb6711e6eb39e05840549d
Reviewed-on: https://gerrit.tine20.org/tine20/972
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: jenkins user
tine20/Inventory/Setup/Update/Release0.php [new file with mode: 0644]
tine20/Inventory/Setup/setup.xml

diff --git a/tine20/Inventory/Setup/Update/Release0.php b/tine20/Inventory/Setup/Update/Release0.php
new file mode 100644 (file)
index 0000000..c86709e
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Tine 2.0
+ *
+ * @package     Inventory
+ * @license     http://www.gnu.org/licenses/agpl.html AGPL3
+ * @copyright   Copyright (c) 2012 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @author      Michael Spahn <m.spahn@metaways.de>
+ */
+
+class Inventory_Setup_Update_Release0 extends Setup_Update_Abstract
+{
+    /**
+     * update to 0.2
+     * @return void
+     */
+    public function update_1()
+    {
+        $field = '<field>
+                    <name>location</name>
+                    <type>text</type>
+                    <length>255</length>
+                </field>';
+        
+        $declaration = new Setup_Backend_Schema_Field_Xml($field);
+        $this->_backend->alterCol('inventory_item', $declaration);
+        
+        $this->setApplicationVersion('Inventory', '0.2');
+        $this->setTableVersion('inventory_item', '2');
+    }
+}
index c93cced..1a99459 100644 (file)
@@ -2,13 +2,13 @@
 <application>
     <name>Inventory</name>
     <!-- gettext('Inventory') -->   
-    <version>0.1</version>
+    <version>0.2</version>
     <order>60</order>
     <status>disabled</status>
     <tables>
         <table>
             <name>inventory_item</name>
-            <version>1</version>
+            <version>2</version>
             <declaration>
                 <field>
                     <name>id</name>
@@ -51,7 +51,6 @@
                     <name>location</name>
                     <type>text</type>
                     <length>255</length>
-                    <notnull>true</notnull>
                 </field>
                 <field>
                     <name>add_time</name>