From fcc57a418245b6cac410f70506f6f4b687c8a98a Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 28 Jun 2009 16:48:29 -0700 Subject: Modify the cache table to make id the primary key for consistency with other gallery 3 tables. Update the driver to match, add more upgrader code, update the installer block and change the gallery module version to 6. --- modules/gallery/helpers/gallery_installer.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'modules/gallery/helpers/gallery_installer.php') diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index d0bfa629..c3c3543c 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -33,7 +33,8 @@ class gallery_installer { ENGINE=InnoDB DEFAULT CHARSET=utf8;"); $db->query("CREATE TABLE {caches} ( - `id` varchar(255) NOT NULL, + `id` int(9) NOT NULL auto_increment, + `key` varchar(255) NOT NULL, `tags` varchar(255), `expiration` int(9) NOT NULL, `cache` longblob, @@ -287,11 +288,20 @@ class gallery_installer { ENGINE=InnoDB DEFAULT CHARSET=utf8;"); module::set_version("gallery", $version = 4); } + if ($version == 4) { Cache::instance()->delete_all(); - $db->query("ALTER TABLE {caches} modify column cache LONGBLOB"); + $db->query("ALTER TABLE {caches} MODIFY COLUMN `cache` LONGBLOB"); module::set_version("gallery", $version = 5); } + + if ($version == 5) { + Cache::instance()->delete_all(); + $db->query("ALTER TABLE {caches} DROP COLUMN `id`"); + $db->query("ALTER TABLE {caches} ADD COLUMN `key` varchar(255) NOT NULL"); + $db->query("ALTER TABLE {caches} ADD COLUMN `id` int(9) NOT NULL auto_increment PRIMARY KEY"); + module::set_version("gallery", $version = 6); + } } static function uninstall() { -- cgit v1.2.3