Skip to content

Commit

Permalink
Added changes to installer and upgrader scripts to support INSERT ON …
Browse files Browse the repository at this point in the history
…DUPLICATE KEY UPDATE SYNTAX in cache lib
  • Loading branch information
Joe7 committed Dec 27, 2010
1 parent f4ecb93 commit 15792c4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion installer/install.sql
Expand Up @@ -43,7 +43,7 @@ CREATE TABLE {caches} (
`expiration` int(9) NOT NULL,
`cache` longblob,
PRIMARY KEY (`id`),
KEY `key` (`key`),
UNIQUE KEY `key` (`key`),
KEY `tags` (`tags`)
) DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
Expand Down
7 changes: 6 additions & 1 deletion modules/gallery/helpers/gallery_installer.php
Expand Up @@ -309,7 +309,7 @@ static function install() {
module::set_var("gallery", "show_user_profiles_to", "registered_users");
module::set_var("gallery", "extra_binary_paths", "/usr/local/bin:/opt/local/bin:/opt/bin");

module::set_version("gallery", 41);
module::set_version("gallery", 42);
}

static function upgrade($version) {
Expand Down Expand Up @@ -642,6 +642,11 @@ static function upgrade($version) {
module::clear_var("gallery", "_cache");
module::set_version("gallery", $version = 41);
}

if ($version == 41) {
$db->query("ALTER TABLE {caches} DROP INDEX `key`, ADD UNIQUE `key` (`key`)");
module::set_version("gallery", $version = 42);
}
}

static function uninstall() {
Expand Down
2 changes: 1 addition & 1 deletion modules/gallery/module.info
@@ -1,3 +1,3 @@
name = "Gallery 3"
description = "Gallery core application"
version = 41
version = 42

0 comments on commit 15792c4

Please sign in to comment.