diff options
Diffstat (limited to '')
-rw-r--r-- | install/db/141-database.php | 45 | ||||
-rw-r--r-- | install/piwigo_structure-mysql.sql | 20 |
2 files changed, 60 insertions, 5 deletions
diff --git a/install/db/141-database.php b/install/db/141-database.php new file mode 100644 index 000000000..f6a157123 --- /dev/null +++ b/install/db/141-database.php @@ -0,0 +1,45 @@ +<?php +// +-----------------------------------------------------------------------+ +// | Piwigo - a PHP based photo gallery | +// +-----------------------------------------------------------------------+ +// | Copyright(C) 2008-2014 Piwigo Team http://piwigo.org | +// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | +// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | +// +-----------------------------------------------------------------------+ +// | This program is free software; you can redistribute it and/or modify | +// | it under the terms of the GNU General Public License as published by | +// | the Free Software Foundation | +// | | +// | This program is distributed in the hope that it will be useful, but | +// | WITHOUT ANY WARRANTY; without even the implied warranty of | +// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | +// | General Public License for more details. | +// | | +// | You should have received a copy of the GNU General Public License | +// | along with this program; if not, write to the Free Software | +// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | +// | USA. | +// +-----------------------------------------------------------------------+ + +defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); + +$upgrade_description = 'add lastmodified field for categories, images, groups, users, tags'; + +$tables = array( + CATEGORIES_TABLE, + GROUPS_TABLE, + IMAGES_TABLE, + TAGS_TABLE, + USER_INFOS_TABLE + ); + +foreach ($tables as $table) +{ + pwg_query(' +ALTER TABLE '. $table .' + ADD `lastmodified` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + ADD INDEX `lastmodified` (`lastmodified`) +;'); +} + +echo "\n".$upgrade_description."\n"; diff --git a/install/piwigo_structure-mysql.sql b/install/piwigo_structure-mysql.sql index 7520d99a4..c05dcb981 100644 --- a/install/piwigo_structure-mysql.sql +++ b/install/piwigo_structure-mysql.sql @@ -36,9 +36,11 @@ CREATE TABLE `piwigo_categories` ( `global_rank` varchar(255) default NULL, `image_order` varchar(128) default NULL, `permalink` varchar(64) binary default NULL, + `lastmodified` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `categories_i3` (`permalink`), - KEY `categories_i2` (`id_uppercat`) + KEY `categories_i2` (`id_uppercat`), + KEY `lastmodified` (`lastmodified`) ) ENGINE=MyISAM; -- @@ -106,8 +108,10 @@ CREATE TABLE `piwigo_groups` ( `id` smallint(5) unsigned NOT NULL auto_increment, `name` varchar(255) NOT NULL default '', `is_default` enum('true','false') NOT NULL default 'false', + `lastmodified` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), - UNIQUE KEY `groups_ui1` (`name`) + UNIQUE KEY `groups_ui1` (`name`), + KEY `lastmodified` (`lastmodified`) ) ENGINE=MyISAM; -- @@ -199,13 +203,15 @@ CREATE TABLE `piwigo_images` ( `rotation` tinyint unsigned default NULL, `latitude` double(8, 6) default NULL, `longitude` double(9, 6) default NULL, + `lastmodified` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `images_i2` (`date_available`), KEY `images_i3` (`rating_score`), KEY `images_i4` (`hit`), KEY `images_i5` (`date_creation`), KEY `images_i1` (`storage_category_id`), - KEY `images_i6` (`latitude`) + KEY `images_i6` (`latitude`), + KEY `lastmodified` (`lastmodified`) ) ENGINE=MyISAM; -- @@ -305,8 +311,10 @@ CREATE TABLE `piwigo_tags` ( `id` smallint(5) unsigned NOT NULL auto_increment, `name` varchar(255) NOT NULL default '', `url_name` varchar(255) binary NOT NULL default '', + `lastmodified` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), - KEY `tags_i1` (`url_name`) + KEY `tags_i1` (`url_name`), + KEY `lastmodified` (`lastmodified`) ) ENGINE=MyISAM; -- @@ -423,7 +431,9 @@ CREATE TABLE `piwigo_user_infos` ( `enabled_high` enum('true','false') NOT NULL default 'true', `level` tinyint unsigned NOT NULL default '0', `activation_key` char(20) default NULL, - PRIMARY KEY (`user_id`) + `lastmodified` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`user_id`), + KEY `lastmodified` (`lastmodified`) ) ENGINE=MyISAM; -- |