fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [9633] controller: alter datatable


From: Sigurd Nes
Subject: [Fmsystem-commits] [9633] controller: alter datatable
Date: Wed, 20 Jun 2012 11:13:46 +0000

Revision: 9633
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9633
Author:   sigurdne
Date:     2012-06-20 11:13:45 +0000 (Wed, 20 Jun 2012)
Log Message:
-----------
controller: alter datatable

Modified Paths:
--------------
    trunk/controller/setup/setup.inc.php
    trunk/controller/setup/tables_current.inc.php
    trunk/controller/setup/tables_update.inc.php

Modified: trunk/controller/setup/setup.inc.php
===================================================================
--- trunk/controller/setup/setup.inc.php        2012-06-19 14:10:56 UTC (rev 
9632)
+++ trunk/controller/setup/setup.inc.php        2012-06-20 11:13:45 UTC (rev 
9633)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['controller']['name'] = 'controller';
-       $setup_info['controller']['version'] = '0.1.38';
+       $setup_info['controller']['version'] = '0.1.39';
        $setup_info['controller']['app_order'] = 100;
        $setup_info['controller']['enable'] = 1;
        $setup_info['controller']['app_group']  = 'office';

Modified: trunk/controller/setup/tables_current.inc.php
===================================================================
--- trunk/controller/setup/tables_current.inc.php       2012-06-19 14:10:56 UTC 
(rev 9632)
+++ trunk/controller/setup/tables_current.inc.php       2012-06-20 11:13:45 UTC 
(rev 9633)
@@ -64,13 +64,13 @@
                        'fd' => array(
                                'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
                                'control_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
-                               'status' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'status' => array('type' => 'int','precision' 
=> '2','nullable' => false),
                                'comment' => array('type' => 'text', 'nullable' 
=> True),
                                'deadline' => array('type' => 'int', 
'precision' => 8, 'nullable' => True),
                                'planned_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True),
                                'completed_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True),
                                'component_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
-                               'location_code' => array('type' => 'varchar', 
'precision' => 30, 'nullable' => false),
+                               'location_code' => array('type' => 'varchar', 
'precision' => 30, 'nullable' => True),
                                'location_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => true),
                                'num_open_cases' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
                                'num_pending_cases' => array('type' => 'int', 
'precision' => 4, 'nullable' => True)

Modified: trunk/controller/setup/tables_update.inc.php
===================================================================
--- trunk/controller/setup/tables_update.inc.php        2012-06-19 14:10:56 UTC 
(rev 9632)
+++ trunk/controller/setup/tables_update.inc.php        2012-06-20 11:13:45 UTC 
(rev 9633)
@@ -732,4 +732,59 @@
                                
                $GLOBALS['setup_info']['controller']['currentver'] = '0.1.38';
                return $GLOBALS['setup_info']['controller']['currentver'];
-       }
\ No newline at end of file
+       }
+
+       $test[] = '0.1.38';
+       function controller_upgrade0_1_38()
+       {
+
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $sql = 'SELECT id,status FROM controller_check_list';
+               $GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+
+               $status_list = array();
+               while ($GLOBALS['phpgw_setup']->oProc->next_record())
+               {
+                       $status_list[] = array
+                       (
+                               'id'            => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
+                               'status'        => (int) 
$GLOBALS['phpgw_setup']->oProc->f('status'),
+                       );
+               }
+
+
+               
$GLOBALS['phpgw_setup']->oProc->DropColumn('controller_check_list', array(), 
'status');
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_list','status',array(
+                       'type' => 'int',
+                       'precision' => 2,
+                       'nullable' => true
+               ));
+
+
+               foreach ($status_list as $entry)
+               {
+                       $sql = "UPDATE controller_check_list SET status = 
{$entry['status']} WHERE id = {$entry['id']} ";
+                       
$GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+               }
+                               
+
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('controller_check_list','status',array(
+                       'type' => 'int',
+                       'precision' => 2,
+                       'nullable' => false
+               ));
+
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('controller_check_list','location_code',array(
+                       'type' => 'varchar', 
+                       'precision' => '30',
+                       'nullable' => true
+               ));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['controller']['currentver'] = 
'0.1.39';
+                       return 
$GLOBALS['setup_info']['controller']['currentver'];
+               }
+       }
+




reply via email to

[Prev in Thread] Current Thread [Next in Thread]