source: trunk/install/db/7-database.php @ 2127

Last change on this file since 2127 was 2059, checked in by rub, 17 years ago

Change headers with team email

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | PhpWebGallery - a PHP based picture gallery                           |
4// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
5// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
6// +-----------------------------------------------------------------------+
7// | file          : $Id: 7-database.php 2059 2007-07-10 05:30:01Z rub $
8// | last update   : $Date: 2007-07-10 05:30:01 +0000 (Tue, 10 Jul 2007) $
9// | last modifier : $Author: rub $
10// | revision      : $Revision: 2059 $
11// +-----------------------------------------------------------------------+
12// | This program is free software; you can redistribute it and/or modify  |
13// | it under the terms of the GNU General Public License as published by  |
14// | the Free Software Foundation                                          |
15// |                                                                       |
16// | This program is distributed in the hope that it will be useful, but   |
17// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
18// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
19// | General Public License for more details.                              |
20// |                                                                       |
21// | You should have received a copy of the GNU General Public License     |
22// | along with this program; if not, write to the Free Software           |
23// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
24// | USA.                                                                  |
25// +-----------------------------------------------------------------------+
26
27if (!defined('PHPWG_ROOT_PATH'))
28{
29  die('Hacking attempt!');
30}
31
32$upgrade_description = 'Anonymous rating';
33
34// +-----------------------------------------------------------------------+
35// |                            Upgrade content                            |
36// +-----------------------------------------------------------------------+
37
38$query = '
39ALTER TABLE '.PREFIX_TABLE.'rate DROP PRIMARY KEY;'
40;
41pwg_query($query);
42
43$query ='
44ALTER TABLE '.PREFIX_TABLE.'rate ADD COLUMN anonymous_id VARCHAR(45) NOT NULL DEFAULT \'\' AFTER element_id;'
45;
46pwg_query($query);
47
48$query ='
49ALTER TABLE '.PREFIX_TABLE.'rate ADD COLUMN date DATE NOT NULL AFTER rate;'
50;
51pwg_query($query);
52
53$query ='
54UPDATE '.PREFIX_TABLE.'rate SET date=NOW() WHERE date<"1990-01-01";'
55;
56pwg_query($query);
57
58$query = '
59ALTER TABLE '.PREFIX_TABLE.'rate ADD PRIMARY KEY (element_id, user_id, anonymous_id);'
60;
61pwg_query($query);
62
63echo
64"\n"
65.'Table '.PREFIX_TABLE.'rate upgraded'
66."\n"
67;
68?>
Note: See TracBrowser for help on using the repository browser.