summaryrefslogtreecommitdiff
path: root/modules/search
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-06-23 12:00:49 -0700
committerBharat Mediratta <bharat@menalto.com>2009-06-23 12:00:49 -0700
commitbfca0c79030d5b8a18e41e8b80f5560ebaf6f202 (patch)
tree71568f5d924277879cf645c0190ebd7c98a80228 /modules/search
parent342d5e118664274fb1d8329734815640f5169887 (diff)
Refactor the install/upgrade code to be more flexible.
Add xxx_installer::upgrade($version) method so that upgrade stanzas are separate from install stanzas. In the old code, to do an upgrade meant that you had to re-evolve everything from the initial install because we'd step through each version's changes. But what we really want is for the initial install to start off in the perfect initial state, and the upgrades to do the work behind the scenes. So now the install() function gets things set up properly the first time, and the upgrade() function does any work to catch you up to the latest code. See gallery_installer.php for a good example.
Diffstat (limited to 'modules/search')
-rw-r--r--modules/search/helpers/search_installer.php23
1 files changed, 10 insertions, 13 deletions
diff --git a/modules/search/helpers/search_installer.php b/modules/search/helpers/search_installer.php
index ed4a3a90..cd253be4 100644
--- a/modules/search/helpers/search_installer.php
+++ b/modules/search/helpers/search_installer.php
@@ -19,20 +19,17 @@
*/
class search_installer {
static function install() {
- $version = module::get_version("search");
$db = Database::instance();
- if ($version == 0) {
- $db->query("CREATE TABLE {search_records} (
- `id` int(9) NOT NULL auto_increment,
- `item_id` int(9),
- `dirty` boolean default 1,
- `data` LONGTEXT default NULL,
- PRIMARY KEY (`id`),
- KEY(`item_id`),
- FULLTEXT INDEX (`data`))
- ENGINE=MyISAM DEFAULT CHARSET=utf8;");
- module::set_version("search", 1);
- }
+ $db->query("CREATE TABLE {search_records} (
+ `id` int(9) NOT NULL auto_increment,
+ `item_id` int(9),
+ `dirty` boolean default 1,
+ `data` LONGTEXT default NULL,
+ PRIMARY KEY (`id`),
+ KEY(`item_id`),
+ FULLTEXT INDEX (`data`))
+ ENGINE=MyISAM DEFAULT CHARSET=utf8;");
+ module::set_version("search", 1);
}
static function activate() {