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

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

Apply property svn:eol-style Value: LF

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