Skip to content

Commit a69bb0f

Browse files
authored
Merge pull request #67 from Marc-pi/master
Marc-pi/mobileapi#1 Add fulltext index for …
2 parents 66b5186 + 858c8a7 commit a69bb0f

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

config/module.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
'meta' => array(
1616
'title' => _a('News'),
1717
'description' => _a('Manage News and Blog'),
18-
'version' => '1.8.5',
18+
'version' => '1.8.6',
1919
'license' => 'New BSD',
2020
'logo' => 'image/logo.png',
2121
'readme' => 'docs/readme.txt',

sql/mysql.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ CREATE TABLE `{story}` (
4040
KEY `story_order` (`time_publish`, `id`)
4141
);
4242

43+
ALTER TABLE `{story}` ADD FULLTEXT `search_idx` (`title`, `text_description`);
44+
45+
4346
CREATE TABLE `{topic}` (
4447
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
4548
`pid` INT(5) UNSIGNED NOT NULL DEFAULT '0',

src/Installer/Action/Update.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,20 @@ public function updateSchema(Event $e)
800800
}
801801
}
802802

803+
if (version_compare($moduleVersion, '1.8.6', '<')) {
804+
$sql = sprintf("ALTER TABLE %s ADD FULLTEXT `search_idx` (`title`, `text_description`);", $storyTable);
805+
try {
806+
$storyAdapter->query($sql, 'execute');
807+
} catch (\Exception $exception) {
808+
$this->setResult('db', array(
809+
'status' => false,
810+
'message' => 'Table alter query failed: '
811+
. $exception->getMessage(),
812+
));
813+
return false;
814+
}
815+
}
816+
803817
return true;
804818
}
805819
}

0 commit comments

Comments
 (0)