-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add migration for changing searchindex table to use InnoDB instaed of…
… MyISAM
- Loading branch information
Levi Zitting
committed
Apr 19, 2019
1 parent
16100ec
commit 706dcfa
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
migrations/m190419_143225_change_search_index_table_to_innodb.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace craft\contentmigrations; | ||
|
||
use Craft; | ||
use craft\db\Migration; | ||
use yii\db\Exception; | ||
|
||
/** | ||
* m190419_143225_change_search_index_table_to_innodb migration. | ||
*/ | ||
class m190419_143225_change_search_index_table_to_innodb extends Migration | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function safeUp() | ||
{ | ||
try { | ||
$this->db->createCommand() | ||
->setSql('ALTER TABLE searchindex ENGINE = InnoDB;') | ||
->execute(); | ||
} catch (Exception $exception) { | ||
echo $exception; | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function safeDown() | ||
{ | ||
try { | ||
$this->db->createCommand() | ||
->setSql('ALTER TABLE searchindex ENGINE = MyISAM;') | ||
->execute(); | ||
} catch (Exception $exception) { | ||
echo $exception; | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
} |