source: companies/serpro/contactcenter/setup/tables_update.inc.php @ 903

Revision 903, 3.6 KB checked in by niltonneto, 15 years ago (diff)

Importacao inicial do Expresso do Serpro

Line 
1<?php
2        /**************************************************************************\
3        * phpGroupWare - Setup                                                     *
4        * http://www.phpgroupware.org                                              *
5        * --------------------------------------------                             *
6        * This program is free software; you can redistribute it and/or modify it  *
7        * under the terms of the GNU General Public License as published by the    *
8        * Free Software Foundation; either version 2 of the License, or (at your   *
9        * option) any later version.                                               *
10        \**************************************************************************/   
11        $test[] = '0.4.1';
12        function contactcenter_upgrade0_4_1() {
13               
14                $oProc = $GLOBALS['phpgw_setup']->oProc;
15                $oProc->DropTable('phpgw_cc_city');
16                $oProc->DropTable('phpgw_cc_state');
17                $oProc->CreateTable(
18                        'phpgw_cc_state',array(
19                                'fd' => array(
20                                        'id_state' => array( 'type' => 'int', 'precision' => 8, 'nullable' => false),
21                                        'id_country' => array( 'type' => 'char', 'nullable' => false, 'precision' => 2),
22                                        'state_name' => array( 'type' => 'varchar', 'precision' => 30),
23                                        'state_symbol' => array( 'type' => 'varchar', 'precision' => 10)
24                                ),
25                                'pk' => array('id_state'),
26                                'fk' => array('id_country' => array('phpgw_common_country_list' => 'id_country')),
27                                'ix' => array(),
28                                'uc' => array()
29                        )
30                );
31                $oProc->CreateTable(
32                        'phpgw_cc_city', array(
33                                'fd' => array(
34                                        'id_city' => array( 'type' => 'int', 'precision' => 8, 'nullable' => false ),
35                                        'id_state' => array( 'type' => 'int', 'precision' => 8 ),
36                                        'id_country' => array( 'type' => 'char', 'nullable' => false, 'precision' => 2),
37                                        'city_timezone' => array( 'type' => 'int', 'precision' => 2 ),
38                                        'city_geo_location' => array(  'type'  => 'varchar', 'precision' => 40 ),
39                                        'city_name' => array( 'type'  => 'varchar', 'precision' => 60, 'nullable' => 'false' ),                         
40                                ),
41                                'pk' => array('id_city'),
42                                'fk' => array('id_state'   => array('phpgw_cc_state' => 'id_state')     ),
43                                'ix' => array(),
44                                'uc' => array()
45                        )               
46                );             
47               
48                include("states_pt-br.inc.php");
49                include("cities_pt-br.inc.php");
50                $GLOBALS['setup_info']['contactcenter']['currentver'] = '1.0.0';
51                return $GLOBALS['setup_info']['contactcenter']['currentver'];
52        }
53        $test[] = '1.0.0';
54        function contactcenter_upgrade1_0_0() {
55                $GLOBALS['setup_info']['contactcenter']['currentver'] = '1.0.005';
56                return $GLOBALS['setup_info']['contactcenter']['currentver'];
57        }
58        $test[] = '1.0.005';
59        function contactcenter_upgrade1_0_005() {
60                $GLOBALS['setup_info']['contactcenter']['currentver'] = '1.14';
61                return $GLOBALS['setup_info']['contactcenter']['currentver'];
62        }
63        $test[] = '1.14';
64        function contactcenter_upgrade1_14() {                         
65                $GLOBALS['phpgw_setup']->db->query("ALTER TABLE phpgw_cc_connections ALTER COLUMN connection_value TYPE varchar(100)");
66                $GLOBALS['setup_info']['contactcenter']['currentver'] = '1.150';
67                return $GLOBALS['setup_info']['contactcenter']['currentver'];
68        }
69        $test[] = '1.15';
70        function contactcenter_upgrade1_15() {
71                $GLOBALS['phpgw_setup']->db->query("ALTER TABLE phpgw_cc_contact ADD COLUMN last_status char(1) DEFAULT 'N'::bpchar");
72                $GLOBALS['phpgw_setup']->db->query("ALTER TABLE phpgw_cc_contact ADD COLUMN last_update int8 DEFAULT (date_part('epoch'::text, ('now'::text)::timestamp(3) with time zone) * (1000)::double precision)");
73                $GLOBALS['phpgw_setup']->db->query("ALTER TABLE phpgw_cc_contact ADD COLUMN category character varying(20)");
74
75                $GLOBALS['setup_info']['contactcenter']['currentver'] = '1.20';
76                return $GLOBALS['setup_info']['contactcenter']['currentver'];
77        }
78
79?>
Note: See TracBrowser for help on using the repository browser.