Navigation Menu

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/02f23169d2967100cb0ce675d7e1a95e to your computer and use it in GitHub Desktop.
Save jamesmacwhite/02f23169d2967100cb0ce675d7e1a95e to your computer and use it in GitHub Desktop.
Field type migration for Table Maker for Craft 2 to Craft 3 migrations
<?php
namespace craft\contentmigrations;
use Craft;
use craft\db\Migration;
use supercool\tablemaker\fields\TableMakerField;
/**
* m190412_182837_tablemaker_update_fieldtype migration.
*
* The Table Maker plugin currently doesn't migrate it's own field type...
* This migration will update the field type, so our matrix body block tables will work!
*
*/
class m190412_182837_tablemaker_update_fieldtype extends Migration
{
/**
* @inheritdoc
*/
public function safeUp()
{
echo " > Updating Table Maker field type...\n";
// Migrate the old TableMaker field
$this->update('{{%fields}}', [
'type' => TableMakerField::class
], ['type' => 'TableMaker']);
return true;
}
/**
* @inheritdoc
*/
public function safeDown()
{
echo "m190412_182837_tablemaker_update_fieldtype cannot be reverted.\n";
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment