8070: check index lengths
authorsstamer <s.stamer@metaways.de>
Mon, 16 Jun 2014 09:57:37 +0000 (11:57 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 21 Jul 2014 15:26:37 +0000 (17:26 +0200)
https://forge.tine20.org/mantisbt/view.php?id=8070
- add update scripts

Change-Id: I647b560955a4fafebb60a53fb53b70f3b34f04cb
Reviewed-on: http://gerrit.tine20.com/customers/400
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Jenkins CI (http://ci.tine20.com/)
14 files changed:
tine20/Calendar/Setup/Update/Release8.php
tine20/Courses/Setup/Update/Release8.php [new file with mode: 0644]
tine20/Courses/Setup/setup.xml
tine20/Felamimail/Setup/Update/Release8.php
tine20/Felamimail/Setup/setup.xml
tine20/Sales/Setup/Update/Release8.php
tine20/Sales/Setup/setup.xml
tine20/Setup/Update/Abstract.php
tine20/Sipgate/Setup/Update/Release2.php [new file with mode: 0644]
tine20/Sipgate/Setup/setup.xml
tine20/Timetracker/Setup/Update/Release8.php
tine20/Timetracker/Setup/setup.xml
tine20/Tinebase/Setup/Update/Release8.php
tine20/Tinebase/Setup/setup.xml

index 38d15c9..6155bd7 100644 (file)
@@ -80,7 +80,6 @@ class Calendar_Setup_Update_Release8 extends Setup_Update_Abstract
         )->fetchAll(Zend_Db::FETCH_ASSOC);
         
         foreach ($eventIds as $eventId) {
-
             $event = $eventBE->get($eventId['id']);
             $event->organizer = (string) Tinebase_User::getInstance()->getFullUserById($event->created_by)->contact_id;
             
diff --git a/tine20/Courses/Setup/Update/Release8.php b/tine20/Courses/Setup/Update/Release8.php
new file mode 100644 (file)
index 0000000..24ce7b0
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Tine 2.0
+ *
+ * @package     Courses
+ * @subpackage  Setup
+ * @license     http://www.gnu.org/licenses/agpl.html AGPL3
+ * @copyright   Copyright (c) 2012 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @author      Stefanie Stamer <s.stamer@metaways.de>
+ */
+class Courses_Setup_Update_Release8 extends Setup_Update_Abstract
+{
+    /**
+     * update to 8.1
+     * - update 256 char fields
+     * 
+     * @see 0008070: check index lengths
+     */
+    public function update_0()
+    {
+        $columns = array("courses" => array(
+                    "name" => '',
+                    "type" => ''
+                    )
+                );
+        $this->truncateTextColumn($columns, 255);
+        
+        $this->setTableVersion('courses', 7);
+        $this->setApplicationVersion('Courses', '8.1');
+    }
+}
\ No newline at end of file
index 22b93c1..2df6919 100644 (file)
@@ -2,7 +2,7 @@
 <application>
     <name>Courses</name>
     <!-- gettext('Courses') -->   
-    <version>8.0</version>
+    <version>8.1</version>
     <order>50</order>
     <status>enabled</status>
     <depends>
@@ -12,7 +12,7 @@
     <tables>
         <table>
             <name>courses</name>
-            <version>6</version>
+            <version>7</version>
             <declaration>
                 <field>
                     <name>id</name>
                 <field>
                     <name>name</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>type</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>internet</name>
index a764719..134e328 100644 (file)
@@ -5,7 +5,7 @@
  * @package     Felamimail
  * @subpackage  Setup
  * @license     http://www.gnu.org/licenses/agpl.html AGPL3
- * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @copyright   Copyright (c) 2013-2014 Metaways Infosystems GmbH (http://www.metaways.de)
  * @author      Philipp Schüle <p.schuele@metaways.de>
  */
 class Felamimail_Setup_Update_Release8 extends Setup_Update_Abstract
@@ -56,7 +56,77 @@ class Felamimail_Setup_Update_Release8 extends Setup_Update_Abstract
         $this->_backend->addCol('felamimail_sieve_rule', $declaration);
         
         $this->setTableVersion('felamimail_sieve_rule', 3);
-        
         $this->setApplicationVersion('Felamimail', '8.2');
     }
+    
+    
+    /**
+     * update to 8.3
+     * - update 256 char fields
+     * 
+     * @see 0008070: check index lengths
+     */
+    public function update_2()
+    {
+        $columns = array("felamimail_account" => array(
+                            "name" => "",
+                            "host" => "",
+                            "email" => "",
+                            "from" => "",
+                            "organization" => "",
+                            "sent_folder" => "",
+                            "trash_folder" => "",
+                            "drafts_folder" => "",
+                            "templates_folder" => "",
+                            "ns_personal" => "",
+                            "ns_other" => "",
+                            "ns_shared" => "",
+                            "smtp_hostname" => "",
+                            "sieve_hostname" => ""
+                            ),
+                        "felamimail_folder" => array(
+                            "localname" => "",
+                            "parent" => ""
+                            ),
+                        "felamimail_cache_message" => array(
+                            "content_type" => "",
+                            "body_content_type" => "",
+                            "from_email" => "",
+                            "from_name" => "",
+                            "sender" => ""
+                            ),
+                        "felamimail_cache_message_to" => array(
+                            "name" => "",
+                            "email" => ""
+                            ),
+                        "felamimail_cache_message_cc" => array(
+                            "name" => "",
+                            "email" => ""
+                            ),
+                        "felamimail_cache_message_bcc" => array(
+                            "name" => "",
+                            "email" => ""
+                            ),
+                        "felamimail_sieve_rule" => array(
+                            "action_type" => "",
+                            "action_argument" => ""
+                            ),
+                        "felamimail_sieve_vacation" => array(
+                            "subject" => "",
+                            "from" => "",
+                            "mime" => ""
+                            )
+                        );
+        
+        $this->truncateTextColumn($columns, 255);
+        $this->setTableVersion('felamimail_account', 20);
+        $this->setTableVersion('felamimail_folder', 14);
+        $this->setTableVersion('felamimail_cache_message', 9);
+        $this->setTableVersion('felamimail_cache_message_to', 2);
+        $this->setTableVersion('felamimail_cache_message_cc', 2);
+        $this->setTableVersion('felamimail_cache_message_bcc', 2);
+        $this->setTableVersion('felamimail_sieve_rule', 3);
+        $this->setTableVersion('felamimail_sieve_vacation', 3);
+        $this->setApplicationVersion('Felamimail', '8.3');
+    }
 }
index ca6c70e..cec2404 100644 (file)
@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="utf-8"?>
 <application>
     <name>Felamimail</name>
-    <version>8.2</version>
+    <version>8.3</version>
     <order>30</order>
     <status>enabled</status>
     <tables>
         <table>
             <name>felamimail_account</name>
-            <version>19</version>
+            <version>20</version>
             <declaration>
                 <field>
                     <name>id</name>
                 <field>
                     <name>name</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>host</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>credentials_id</name>
                 <field>
                     <name>email</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>from</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>organization</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>port</name>
                 <field>
                     <name>sent_folder</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>trash_folder</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>drafts_folder</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>templates_folder</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>has_children_support</name>
                 <field>
                     <name>ns_personal</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>ns_other</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>ns_shared</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>signature</name>
                 <field>
                     <name>smtp_hostname</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>smtp_port</name>
                 <field>
                     <name>sieve_hostname</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>sieve_port</name>
         </table>
         <table>
             <name>felamimail_folder</name>
-            <version>13</version>
+            <version>14</version>
             <declaration>
                 <field>
                     <name>id</name>
                 <field>
                     <name>localname</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>globalname</name>
                 <field>
                     <name>parent</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>delimiter</name>
         </table>
         <table>
             <name>felamimail_cache_message</name>
-            <version>8</version>
+            <version>9</version>
             <declaration>
                 <field>
                     <name>id</name>
                 <field>
                     <name>content_type</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>body_content_type</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>from_email</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>from_name</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>sender</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>has_attachment</name>
         </table>
         <table>
             <name>felamimail_cache_message_to</name>
-            <version>1</version>
+            <version>2</version>
             <declaration>
                 <field>
                     <name>message_id</name>
                 <field>
                     <name>name</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>email</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <index>
                     <name>to::message_id--message::id</name>
         </table>
         <table>
             <name>felamimail_cache_message_cc</name>
-            <version>1</version>
+            <version>2</version>
             <declaration>
                 <field>
                     <name>message_id</name>
                 <field>
                     <name>name</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>email</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <index>
                     <name>cc::message_id--message::id</name>
         </table>
         <table>
             <name>felamimail_cache_message_bcc</name>
-            <version>1</version>
+            <version>2</version>
             <declaration>
                 <field>
                     <name>message_id</name>
                 <field>
                     <name>name</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>email</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <index>
                     <name>bcc::message_id--message::id</name>
                 <field>
                     <name>action_type</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>action_argument</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>conditions</name>
         </table>
         <table>
             <name>felamimail_sieve_vacation</name>
-            <version>2</version>
+            <version>3</version>
             <declaration>
                 <field>
                     <name>id</name>
                 <field>
                     <name>subject</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>from</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>mime</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>days</name>
index 5711f57..10b207b 100644 (file)
@@ -32,4 +32,23 @@ class Sales_Setup_Update_Release8 extends Setup_Update_Abstract
         
         $this->setApplicationVersion('Sales', '8.1');
     }
+    
+    /**
+     * update to 8.1
+     * - update 256 char fields
+     * 
+     * @see 0008070: check index lengths
+     */
+    public function update_1()
+    {
+        $columns = array("sales_contracts" => array(
+                    "title" => "true",
+                    "cleared_in" => "false"
+                    )
+                );
+        
+        $this->truncateTextColumn($columns, 255);
+        $this->setTableVersion('sales_contracts', 6);
+        $this->setApplicationVersion('Sales', '8.2');
+    }
 }
index 19e0e49..ebc4d30 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <application>
     <name>Sales</name>
-    <version>8.1</version>
+    <version>8.2</version>
     <order>50</order>
     <status>enabled</status>
     <tables>
@@ -55,7 +55,7 @@
         </table>
         <table>
             <name>sales_contracts</name>
-            <version>5</version>
+            <version>6</version>
             <declaration>
                 <field>
                     <name>id</name>
@@ -83,7 +83,7 @@
                 <field>
                     <name>title</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                     <notnull>true</notnull>
                 </field>
                 <field>
index aacf94d..3676f61 100644 (file)
@@ -270,4 +270,70 @@ class Setup_Update_Abstract
     {
         return $this->_db;
     }
+    
+    /**
+     * Search for text fields that contain a string longer as a specific length and truncate it to this length
+     * 
+     * @param string $table
+     * @param string $field
+     * @param int $length
+     */
+    public function shortenTextValues($table, $field, $length)
+    {
+        $results = $this->_db->query(
+            "SELECT " . $this->_db->quoteIdentifier($field) .
+            ", LEFT(" . $this->_db->quoteIdentifier($field) . "," . $length . ") AS `short`" .
+            " FROM " . $this->_db->quoteIdentifier(SQL_TABLE_PREFIX . $table) .
+            " WHERE CHAR_LENGTH(" . $this->_db->quoteIdentifier($field) . ") > " . $length
+            )->fetchAll();
+        
+        foreach ($results as $result) {
+            $where  = array(
+                $this->_db->quoteInto($this->_db->quoteIdentifier($field) . ' = ?', $result[$field]),
+            );
+            
+            $newContent = array($field => $result['short']);
+            
+            try {
+                $this->_db->update(SQL_TABLE_PREFIX . $table, $newContent, $where);
+                Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__
+                    . ' Field was shortend: ' . print_r($result, true));
+            } catch (Tinebase_Exception_Record_Validation $terv) {
+                Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__
+                    . ' Failed to shorten field: ' . print_r($result, true));
+                Tinebase_Exception::log($terv);
+            }
+        }
+    }
+    
+    /**
+     * truncate text fields to a specific length
+     * Array needs to contain the table name, field name, and a config option for "<notnull>" ("true", "false")
+     * or use "null" to set default to NULL
+     * 
+     * @param array $columns
+     * @param int $length
+     */
+    public function truncateTextColumn($columns, $length)
+    {
+        foreach ($columns as $table => $fields) {
+            foreach ($fields as $field => $config) {
+                
+                $this->shortenTextValues($table, $field, $length);
+                if (isset($config)) {
+                    $config = ($config == 'null' ? '<default>NULL</default>': '<notnull>' . $config . '</notnull>');
+                }
+                $declaration = new Setup_Backend_Schema_Field_Xml('
+                    <field>
+                        <name>' . $field . '</name>
+                        <type>text</type>
+                        <length>' . $length . '</length>'
+                        . $config .
+                    '</field>
+                ');
+                
+                $this->_backend->alterCol($table, $declaration);
+            }
+        }
+    }
 }
diff --git a/tine20/Sipgate/Setup/Update/Release2.php b/tine20/Sipgate/Setup/Update/Release2.php
new file mode 100644 (file)
index 0000000..59469a9
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+/**
+ * Tine 2.0
+ *
+ * @package     Sipgate
+ * @subpackage  Setup
+ * @license     http://www.gnu.org/licenses/agpl.html AGPL3
+ * @copyright   Copyright (c) 2011 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @author      Stefanie Stamer <s.stamer@metaways.de>
+ */
+
+/**
+ * Sipgate updates for version 2.1
+ *
+ * @package     Sipgate
+ * @subpackage  Setup
+ */
+class Sipgate_Setup_Update_Release2 extends Setup_Update_Abstract
+{
+
+    /**
+     * update to 8.2
+     * - update 256 char fields
+     * 
+     * @see 0008070: check index lengths
+     */
+    public function update_0()
+    {
+        $columns = array("sipgate_line" => array(
+                        "uri_alias" => "",
+                        "sip_uri" => "",
+                        "e164_out" => "",
+                        "e164_in" => ""
+                    ),
+                    "sipgate_connection" => array(
+                        "tarif" => "",
+                        "local_uri" => "true",
+                        "remote_uri" => "true"
+                    ),
+                );
+        
+        $this->truncateTextColumn($columns, 255);
+        $this->setTableVersion('sipgate_line', 1);
+        $this->setTableVersion('sipgate_connection', 1);
+        $this->setApplicationVersion('Sipgate', '2.1');
+    }
+}
index 61793ba..0c16be4 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <application>
     <name>Sipgate</name>
-    <version>2.0</version>
+    <version>2.1</version>
     <order>25</order>
     <depends>
         <application>Admin</application>
         </table>
         <table>
             <name>sipgate_line</name>
-            <version>0</version>
+            <version>1</version>
             <declaration>
                 <field>
                     <name>id</name>
                 <field>
                     <name>uri_alias</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>sip_uri</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>e164_out</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>e164_in</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>tos</name>
         </table>
         <table>
             <name>sipgate_connection</name>
-            <version>0</version>
+            <version>1</version>
             <declaration>
                 <field>
                     <name>id</name>
                 <field>
                     <name>local_uri</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                     <notnull>true</notnull>
                 </field>
                 <field>
                     <name>remote_uri</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                     <notnull>true</notnull>
                 </field>
                 <field>
                 <field>
                     <name>tarif</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>duration</name>
index b9ba6fd..2f93565 100644 (file)
@@ -19,4 +19,28 @@ class Timetracker_Setup_Update_Release8 extends Setup_Update_Abstract
         $this->setTableVersion('timetracker_timesheet', 4);
         $this->setApplicationVersion('Timetracker', '8.1');
     }
+    
+    /**
+     * update to 8.2
+     * - update 256 char fields
+     * 
+     * @see 0008070: check index lengths
+     */
+    public function update_1()
+    {
+        $columns = array("timetracker_timeaccount" => array(
+                            "billed_in" => "false",
+                            "deadline" => "false",
+                            "title" => "true"
+                            ),
+                        "timetracker_timesheet" => array(
+                            "billed_in" => "false"
+                            )
+                        );
+        
+        $this->truncateTextColumn($columns, 255);
+        $this->setTableVersion('timetracker_timeaccount', 10);
+        $this->setTableVersion('timetracker_timesheet', 5);
+        $this->setApplicationVersion('Timetracker', '8.2');
+    }
 }
index b8e3e60..5061a71 100644 (file)
@@ -2,7 +2,7 @@
 <application>
     <name>Timetracker</name>
     <!-- gettext('Timetracker') -->   
-    <version>8.1</version>
+    <version>8.2</version>
     <order>60</order>
     <status>enabled</status>
     <depends>
@@ -11,7 +11,7 @@
     <tables>
         <table>
             <name>timetracker_timeaccount</name>
-            <version>9</version>
+            <version>10</version>
             <declaration>
                 <field>
                     <name>id</name>
@@ -27,7 +27,7 @@
                 <field>
                     <name>title</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                     <notnull>true</notnull>
                 </field>
                 <field>
@@ -70,7 +70,7 @@
                 <field>
                     <name>billed_in</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                     <notnull>false</notnull>
                 </field>
                 <field>
@@ -90,7 +90,7 @@
                 <field>
                     <name>deadline</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                     <notnull>false</notnull>
                 </field>
                 <field>
         </table>
         <table>
             <name>timetracker_timesheet</name>
-            <version>4</version>
+            <version>5</version>
             <declaration>
                 <field>
                     <name>id</name>
                 <field>
                     <name>billed_in</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                     <notnull>false</notnull>
                 </field>
                 <field>
index d205135..847b564 100644 (file)
@@ -59,4 +59,35 @@ class Tinebase_Setup_Update_Release8 extends Setup_Update_Abstract
         
         $this->setApplicationVersion('Tinebase', '8.2');
     }
+    
+    /**
+     * update to 8.3
+     * - update 256 char fields
+     * 
+     * @see 0008070: check index lengths
+     */
+    public function update_2()
+    {
+        $columns = array("container" => array(
+                            "name" => 'true'
+                            ),
+                        "note_types" => array(
+                            "icon" => 'true',
+                            "description" => 'null'
+                            ),
+                        "tags" => array(
+                            "name" => 'null',
+                            "description" => 'null'
+                            ),
+                        "accounts" => array(
+                            "home_dir" => 'false'
+                            )
+                        );
+        $this->truncateTextColumn($columns, 255);
+        $this->setTableVersion('container', '9');
+        $this->setTableVersion('note_types', '3');
+        $this->setTableVersion('tags', '7');
+        $this->setTableVersion('accounts', '10');
+        $this->setApplicationVersion('Tinebase', '8.3');
+    }
 }
index db024cb..e7a21b5 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <application>
     <name>Tinebase</name>
-    <version>8.2</version>
+    <version>8.3</version>
     <tables>
         <table>
             <name>applications</name>
 
         <table>
             <name>accounts</name>
-            <version>9</version>
+            <version>10</version>
             <declaration>
                 <field>
                     <name>id</name>
                 <field>
                     <name>home_dir</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                     <notnull>false</notnull>
                 </field>
                 <field>
         </table>
         <table>
             <name>container</name>
-            <version>8</version>
+            <version>9</version>
             <declaration>
                 <field>
                     <name>id</name>
                 <field>
                     <name>name</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                     <notnull>true</notnull>
                 </field>
                 <field>
 
         <table>
             <name>tags</name>
-            <version>6</version>
+            <version>7</version>
             <declaration>
                 <field>
                     <name>id</name>
                 <field>
                     <name>name</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                     <default>NULL</default>
                 </field>
                 <field>
                     <name>description</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                     <default>NULL</default>
                 </field>
                 <field>
         </table>
         <table>
             <name>note_types</name>
-            <version>2</version>
+            <version>3</version>
             <declaration>
                 <field>
                     <name>id</name>
                 <field>
                     <name>description</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                     <default>NULL</default>
                 </field>
                 <field>
                     <name>icon</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                     <notnull>true</notnull>
                 </field>
                 <field>