source: trunk/install/db/54-database.php @ 2297

Last change on this file since 2297 was 2297, checked in by plg, 16 years ago

Modification: new header on PHP files, PhpWebGallery renamed Piwigo.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Piwigo - a PHP based picture gallery                                  |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2008      Piwigo Team                  http://piwigo.org |
6// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
7// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
8// +-----------------------------------------------------------------------+
9// | This program is free software; you can redistribute it and/or modify  |
10// | it under the terms of the GNU General Public License as published by  |
11// | the Free Software Foundation                                          |
12// |                                                                       |
13// | This program is distributed in the hope that it will be useful, but   |
14// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
15// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
16// | General Public License for more details.                              |
17// |                                                                       |
18// | You should have received a copy of the GNU General Public License     |
19// | along with this program; if not, write to the Free Software           |
20// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
21// | USA.                                                                  |
22// +-----------------------------------------------------------------------+
23// +-----------------------------------------------------------------------+
24// | PhpWebGallery - a PHP based picture gallery                           |
25// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
26// +-----------------------------------------------------------------------+
27// | file          : $Id: 54-database.php 2297 2008-04-04 22:57:23Z plg $
28// | last update   : $Date: 2008-04-04 22:57:23 +0000 (Fri, 04 Apr 2008) $
29// | last modifier : $Author: plg $
30// | revision      : $Revision: 2297 $
31// +-----------------------------------------------------------------------+
32// | This program is free software; you can redistribute it and/or modify  |
33// | it under the terms of the GNU General Public License as published by  |
34// | the Free Software Foundation                                          |
35// |                                                                       |
36// | This program is distributed in the hope that it will be useful, but   |
37// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
38// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
39// | General Public License for more details.                              |
40// |                                                                       |
41// | You should have received a copy of the GNU General Public License     |
42// | along with this program; if not, write to the Free Software           |
43// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
44// | USA.                                                                  |
45// +-----------------------------------------------------------------------+
46
47if (!defined('PHPWG_ROOT_PATH'))
48{
49  die('Hacking attempt!');
50}
51
52$upgrade_description = 'add column #categories.permalink and table #old_permalinks';
53
54include_once(PHPWG_ROOT_PATH.'include/constants.php');
55
56// +-----------------------------------------------------------------------+
57// |                            Upgrade content                            |
58// +-----------------------------------------------------------------------+
59
60defined('OLD_PERMALINKS_TABLE') or die('OLD_PERMALINKS_TABLE is not defined');
61
62$query = "
63CREATE TABLE `".OLD_PERMALINKS_TABLE."` (
64  `cat_id` smallint(5) unsigned NOT NULL,
65  `permalink` VARCHAR(64) NOT NULL,
66  `date_deleted` datetime NOT NULL,
67  `last_hit` datetime default NULL,
68  `hit` int(10) unsigned NOT NULL default '0',
69  PRIMARY KEY (`permalink`)
70) TYPE=MyISAM
71;";
72pwg_query($query);
73
74$query = "
75ALTER TABLE `".CATEGORIES_TABLE."`
76  ADD COLUMN `permalink` VARCHAR(64) default NULL
77;";
78pwg_query($query);
79
80$query = "
81ALTER TABLE `".CATEGORIES_TABLE."`
82  ADD UNIQUE INDEX `categories_i3` (`permalink`)
83;";
84pwg_query($query);
85
86echo
87"\n"
88.'"'.$upgrade_description.'"'.' ended'
89."\n"
90;
91
92?>
Note: See TracBrowser for help on using the repository browser.