Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesmacwhite/bbce570b02ac4e83cf1c98fad7fde600 to your computer and use it in GitHub Desktop.
Save jamesmacwhite/bbce570b02ac4e83cf1c98fad7fde600 to your computer and use it in GitHub Desktop.
Migration for updating Retour widget from Craft 2
<?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