Fixed post showing on MySQL driver

This commit is contained in:
Marcin Kurczewski 2014-04-21 00:16:14 +02:00
parent 4847448a26
commit 1ec5161faf

View file

@ -8,7 +8,10 @@ class PostSearchService extends AbstractSearchService
{
return Database::transaction(function() use ($searchQuery, $postId)
{
$stmt = new Sql\RawStatement('CREATE TEMPORARY TABLE IF NOT EXISTS post_search(id INTEGER PRIMARY KEY, post_id INTEGER)');
if (Database::getDriver() == 'sqlite')
$stmt = new Sql\RawStatement('CREATE TEMPORARY TABLE IF NOT EXISTS post_search(id INTEGER PRIMARY KEY AUTOINCREMENT, post_id INTEGER)');
else
$stmt = new Sql\RawStatement('CREATE TEMPORARY TABLE IF NOT EXISTS post_search(id INTEGER PRIMARY KEY AUTO_INCREMENT, post_id INTEGER)');
Database::exec($stmt);
$stmt = new Sql\DeleteStatement();