source: trunk/news_admin/setup/tables_update.inc.php @ 1323

Revision 1323, 5.9 KB checked in by niltonneto, 15 years ago (diff)

Ticket #563 - Alteradas versões dos módulos, conforme modelo de versionamento.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
RevLine 
[2]1<?php
2        /**************************************************************************\
3        * eGroupWare - Webpage news admin                                          *
4        * http://www.egroupware.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        * This program was sponsered by Golden Glair productions                   *
12        * http://www.goldenglair.com                                               *
13        \**************************************************************************/
14
15
16        $test[] = '0.0.1';
17        function news_admin_upgrade0_0_1()
18        {
19                global $setup_info;
20
21                $setup_info['news_admin']['currentver'] = '0.8.1';
22                return $setup_info['news_admin']['currentver'];
23        }
24
25        $test[] = '0.8.1';
26        function news_admin_upgrade0_8_1()
27        {
28                global $setup_info, $phpgw_setup;
29
30                $phpgw_setup->oProc->RenameTable('webpage_news','phpgw_news');
31
32                $setup_info['news_admin']['currentver'] = '0.8.1.001';
33                return $setup_info['news_admin']['currentver'];
34        }
35
36        $test[] = '0.8.1.001';
37        function news_admin_upgrade0_8_1_001()
38        {
39                global $setup_info, $phpgw_setup;
40
41                $phpgw_setup->oProc->AddColumn('phpgw_news','news_cat',array('type' => 'int','precision' => 4,'nullable' => True));
42                $phpgw_setup->oProc->query("update phpgw_news set news_cat='0'",__LINE__,__FILE__);
43
44                $setup_info['news_admin']['currentver'] = '0.8.1.002';
45                return $setup_info['news_admin']['currentver'];
46        }
47
48        $test[] = '0.8.1.002';
49        function news_admin_upgrade0_8_1_002()
50        {
51                $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_news','news_teaser',array(
52                        'type' => 'varchar',
53                        'precision' => '255',
54                        'nullable' => True
55                ));
56
57
58                $GLOBALS['setup_info']['news_admin']['currentver'] = '0.9.14.500';
59                return $GLOBALS['setup_info']['news_admin']['currentver'];
60        }
61
62        $test[] = '0.9.14.500';
63        function news_admin_upgrade0_9_14_500()
64        {
65                $GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_news_export',array(
66                        'fd' => array(
67                                'cat_id' => array('type' => 'int','precision' => '4','nullable' => False),
68                                'export_type' => array('type' => 'int','precision' => '2','nullable' => True),
69                                'export_itemsyntax' => array('type' => 'int','precision' => '2','nullable' => True),
70                                'export_title' => array('type' => 'varchar','precision' => '255','nullable' => True),
71                                'export_link' => array('type' => 'varchar','precision' => '255','nullable' => True),
72                                'export_description' => array('type' => 'text', 'nullable' => True),
73                                'export_img_title' => array('type' => 'varchar','precision' => '255','nullable' => True),
74                                'export_img_url' => array('type' => 'varchar','precision' => '255','nullable' => True),
75                                'export_img_link' => array('type' => 'varchar','precision' => '255','nullable' => True),
76                        ),
77                        'pk' => array('cat_id'),
78                        'fk' => array(),
79                        'ix' => array(),
80                        'uc' => array()
81                ));
82
83                $GLOBALS['setup_info']['news_admin']['currentver'] = '0.9.14.501';
84                return $GLOBALS['setup_info']['news_admin']['currentver'];
85        }
86
87        $test[] = '0.9.14.501';
88        function news_admin_upgrade0_9_14_501()
89        {
90                $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_news','news_begin',array(
91                        'type' => 'int','precision' => '4','nullable' => True
92                ));
93                $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_news','news_end',array(
94                        'type' => 'int','precision' => '4','nullable' => True
95                ));
96                $db2 = $GLOBALS['phpgw_setup']->db;
97                $GLOBALS['phpgw_setup']->oProc->query('SELECT news_id,news_status FROM phpgw_news');
98                while($GLOBALS['phpgw_setup']->oProc->next_record())
99                {
100                        $unixtimestampmax = 2147483647;
101                        $db2->query('UPDATE phpgw_news SET news_begin=news_date,news_end=' .
102                                (($GLOBALS['phpgw_setup']->oProc->f('news_status') == 'Active') ? $unixtimestampmax : 'news_date') .
103                                ' WHERE news_id=' . $GLOBALS['phpgw_setup']->oProc->f('news_id'));
104                }
105                $newtbldef = array(
106                        'fd' => array(
107                                'news_id' => array('type' => 'auto','nullable' => False),
108                                'news_date' => array('type' => 'int','precision' => '4','nullable' => True),
109                                'news_subject' => array('type' => 'varchar','precision' => '255','nullable' => True),
110                                'news_submittedby' => array('type' => 'varchar','precision' => '255','nullable' => True),
111                                'news_content' => array('type' => 'blob','nullable' => True),
112                                'news_begin' => array('type' => 'int','precision' => '4','nullable' => True),
113                                'news_end' => array('type' => 'int','precision' => '4','nullable' => True),
114                                'news_cat' => array('type' => 'int','precision' => '4','nullable' => True),
115                                'news_teaser' => array('type' => 'varchar','precision' => '255','nullable' => True)
116                        ),
117                        'pk' => array('news_id'),
118                        'fk' => array(),
119                        'ix' => array('news_date','news_subject'),
120                        'uc' => array()
121                );
122                $GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_news',$newtbldef,'news_status');
123
124                $GLOBALS['setup_info']['news_admin']['currentver'] = '0.9.14.502';
125                return $GLOBALS['setup_info']['news_admin']['currentver'];
126        }
127
128
129        $test[] = '0.9.14.502';
130        function news_admin_upgrade0_9_14_502()
131        {
132                $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_news','is_html',array(
133                        'type' => 'int',
134                        'precision' => '2',
135                        'nullable' => False,
136                        'default' => '0'
137                ));
138
139
140                $GLOBALS['setup_info']['news_admin']['currentver'] = '0.9.14.503';
141                return $GLOBALS['setup_info']['news_admin']['currentver'];
142        }
143
144
145        $test[] = '0.9.14.503';
146        function news_admin_upgrade0_9_14_503()
147        {
148                $GLOBALS['setup_info']['news_admin']['currentver'] = '1.0.0';
149                return $GLOBALS['setup_info']['news_admin']['currentver'];
150        }
[1323]151        $test[] = '1.0.0';
152        function news_admin_upgrade1_0_0()
153        {
154                $GLOBALS['setup_info']['news_admin']['currentver'] = '2.0.000';
155                return $GLOBALS['setup_info']['news_admin']['currentver'];
156        }
[2]157?>
Note: See TracBrowser for help on using the repository browser.