Created
April 16, 2019 11:13
-
-
Save jamesmacwhite/bbce570b02ac4e83cf1c98fad7fde600 to your computer and use it in GitHub Desktop.
Migration for updating Retour widget from Craft 2
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
<?php | |
namespace craft\contentmigrations; | |
use Craft; | |
use craft\db\Migration; | |
use nystudio107\retour\widgets\RetourWidget; | |
/** | |
* m190416_110112_update_retour_widget_type migration. | |
* | |
* Update retour widget type, as the plugin itself doesn't handle this currently | |
* | |
*/ | |
class m190416_110112_update_retour_widget_type extends Migration | |
{ | |
/** | |
* @inheritdoc | |
*/ | |
public function safeUp() | |
{ | |
echo " > Updating Retour widget type\n"; | |
$this->update('{{%widgets}}', [ | |
'type' => RetourWidget::class | |
], ['type' => 'Retour']); | |
return true; | |
} | |
/** | |
* @inheritdoc | |
*/ | |
public function safeDown() | |
{ | |
echo "m190416_110112_update_retour_widget_type cannot be reverted.\n"; | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment