diff options
Diffstat (limited to '')
-rw-r--r-- | install/db/92-database.php | 57 | ||||
-rw-r--r-- | install/piwigo_structure-mysql.sql | 1 | ||||
-rw-r--r-- | install/piwigo_structure-pdo-sqlite.sql | 1 | ||||
-rw-r--r-- | install/piwigo_structure-pgsql.sql | 1 | ||||
-rw-r--r-- | install/piwigo_structure-sqlite.sql | 1 |
5 files changed, 61 insertions, 0 deletions
diff --git a/install/db/92-database.php b/install/db/92-database.php new file mode 100644 index 000000000..7ac5c52da --- /dev/null +++ b/install/db/92-database.php @@ -0,0 +1,57 @@ +<?php +// +-----------------------------------------------------------------------+ +// | Piwigo - a PHP based picture gallery | +// +-----------------------------------------------------------------------+ +// | Copyright(C) 2008-2010 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. | +// +-----------------------------------------------------------------------+ + +if (!defined('PHPWG_ROOT_PATH')) +{ + die('Hacking attempt!'); +} + +$upgrade_description = 'New colum images.added_by, reference to users.id'; + +// Add column +$query = 'ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN '; + +if ('mysql' == $conf['dblayer']) +{ + $query.= ' added_by smallint(5)'; +} + +if (in_array($conf['dblayer'], array('pgsql', 'sqlite', 'pdo-sqlite'))) +{ + $query.= ' "added_by" INTEGER default 0'; +} + +$query.= ' NOT NULL;'; + +pwg_query($query); + +// set the existing photos with the webmaster_id as added_by +$query = 'UPDATE '.IMAGES_TABLE.' SET added_by = '.$conf['webmaster_id'].';'; +pwg_query($query); + +echo +"\n" +. $upgrade_description +."\n" +; +?>
\ No newline at end of file diff --git a/install/piwigo_structure-mysql.sql b/install/piwigo_structure-mysql.sql index 44124f072..a241ab1f4 100644 --- a/install/piwigo_structure-mysql.sql +++ b/install/piwigo_structure-mysql.sql @@ -195,6 +195,7 @@ CREATE TABLE `piwigo_images` ( `high_filesize` mediumint(9) unsigned default NULL, `level` tinyint unsigned NOT NULL default '0', `md5sum` char(32) default NULL, + `added_by` smallint(5) NOT NULL default '0', PRIMARY KEY (`id`), KEY `images_i2` (`date_available`), KEY `images_i3` (`average_rate`), diff --git a/install/piwigo_structure-pdo-sqlite.sql b/install/piwigo_structure-pdo-sqlite.sql index e4aa71ca3..0c38b4008 100644 --- a/install/piwigo_structure-pdo-sqlite.sql +++ b/install/piwigo_structure-pdo-sqlite.sql @@ -191,6 +191,7 @@ CREATE TABLE piwigo_images "high_filesize" INTEGER, "level" INTEGER default 0 NOT NULL, "md5sum" CHAR(32), + "added_by" INTEGER default 0 NOT NULL, PRIMARY KEY ("id") ); diff --git a/install/piwigo_structure-pgsql.sql b/install/piwigo_structure-pgsql.sql index f4679cc83..5f9d5a8cf 100644 --- a/install/piwigo_structure-pgsql.sql +++ b/install/piwigo_structure-pgsql.sql @@ -235,6 +235,7 @@ CREATE TABLE "piwigo_images" "high_filesize" INTEGER, "level" INTEGER default 0 NOT NULL, "md5sum" CHAR(32), + "added_by" INTEGER default 0 NOT NULL, PRIMARY KEY ("id") ); diff --git a/install/piwigo_structure-sqlite.sql b/install/piwigo_structure-sqlite.sql index e4aa71ca3..0c38b4008 100644 --- a/install/piwigo_structure-sqlite.sql +++ b/install/piwigo_structure-sqlite.sql @@ -191,6 +191,7 @@ CREATE TABLE piwigo_images "high_filesize" INTEGER, "level" INTEGER default 0 NOT NULL, "md5sum" CHAR(32), + "added_by" INTEGER default 0 NOT NULL, PRIMARY KEY ("id") ); |