source: trunk/install/db/42-database.php @ 2299

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

Bug fixed: as rvelices notified me by email, my header replacement script was
bugged (r2297 was repeating new and old header).

By the way, I've also removed the replacement keywords. We were using them
because it was a common usage with CVS but it is advised not to use them with
Subversion. Personnaly, it is a problem when I search differences between 2
Piwigo installations outside Subversion.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 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
24if (!defined('PHPWG_ROOT_PATH'))
25{
26  die('Hacking attempt!');
27}
28
29$upgrade_description = 'History table new model and new table history_summary';
30
31include_once(PHPWG_ROOT_PATH.'include/constants.php');
32
33// +-----------------------------------------------------------------------+
34// |                            Upgrade content                            |
35// +-----------------------------------------------------------------------+
36
37echo "Recreate table ".HISTORY_TABLE."\n";
38
39$query = 'DROP TABLE '.HISTORY_TABLE.';';
40pwg_query($query);
41
42$query = "
43CREATE TABLE `".HISTORY_TABLE."` (
44  `id` int(10) unsigned NOT NULL auto_increment,
45  `date` date NOT NULL default '0000-00-00',
46  `time` time NOT NULL default '00:00:00',
47  `year` smallint(4) NOT NULL default '0',
48  `month` tinyint(2) NOT NULL default '0',
49  `day` tinyint(2) NOT NULL default '0',
50  `hour` tinyint(2) NOT NULL default '0',
51  `user_id` smallint(5) NOT NULL default '0',
52  `IP` varchar(15) NOT NULL default '',
53  `section` enum('categories','tags','search','list','favorites','most_visited','best_rated','recent_pics','recent_cats') default NULL,
54  `category_id` smallint(5) default NULL,
55  `tag_ids` varchar(50) default NULL,
56  `image_id` mediumint(8) default NULL,
57  `summarized` enum('true','false') default 'false',
58  PRIMARY KEY  (`id`),
59  KEY `history_i1` (`summarized`)
60) TYPE=MyISAM
61;";
62pwg_query($query);
63
64echo "Create table ".HISTORY_SUMMARY_TABLE."\n";
65$query = "
66CREATE TABLE `".HISTORY_SUMMARY_TABLE."` (
67  `id` varchar(13) NOT NULL default '',
68  `year` smallint(4) NOT NULL default '0',
69  `month` tinyint(2) default NULL,
70  `day` tinyint(2) default NULL,
71  `hour` tinyint(2) default NULL,
72  `nb_pages` int(11) default NULL,
73  PRIMARY KEY  (`id`)
74) TYPE=MyISAM
75;";
76pwg_query($query);
77
78echo
79"\n"
80.'"'.$upgrade_description.'"'.' ended'
81."\n"
82;
83
84?>
Note: See TracBrowser for help on using the repository browser.