Skip to content

Commit

Permalink
Add migration for changing searchindex table to use InnoDB instaed of…
Browse files Browse the repository at this point in the history
… 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.
47 changes: 47 additions & 0 deletions migrations/m190419_143225_change_search_index_table_to_innodb.php
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;
}
}

0 comments on commit 706dcfa

Please sign in to comment.