Change Method.

More information on this method is available here:
http://docs.phinx.org/en/latest/migrations.html#the-change-method
@return void
191865
public function change()
    {
        $table = $this->table('widgets');
        $table->changeColumn('trashed', 'datetime', [
            'default' => null,
            'null' => true,
        ]);
        $table->update();

        // Update existing records to set null for non-deleted ones
        // NOTE: cast to char is needed for the mysql 5.7*!
        $count = $this->execute('UPDATE widgets SET trashed=NULL WHERE CAST(trashed AS CHAR(20)) = "0000-00-00 00:00:00"');
    }
1346427
public function up()
    {
        $driver = Schema::getConnection()->getDriverName();
        // Even though we take care of this scenario in the code,
        // SQL Server does not allow potential cascading loops,
        // so set the default no action and clear out created/modified by another user when deleting a user.
        $onDelete = (('sqlsrv' === $driver) ? 'no action' : 'set null');

        $output = new ConsoleOutput();
        $output->writeln("Migration driver used: $driver");

        // Script Service Config
        if (!Schema::hasTable('script_config')) {
            Schema::create(
                'script_config',
                function (Blueprint $t) {
                    $t->integer('service_id')->unsigned()->primary();
                    $t->foreign('service_id')->references('id')->on('service')->onDelete('cascade');
                    $t->mediumText('content')->nullable();
                    $t->text('config')->nullable();
                }
            );
        }

        // Event Scripts
        if (!Schema::hasTable('event_script')) {
            Schema::create(
                'event_script',
                function (Blueprint $t) use ($onDelete) {
                    $t->string('name', 80)->primary();
                    $t->string('type', 40);
                    $t->boolean('is_active')->default(0);
                    $t->mediumText('content')->nullable();
                    $t->text('config')->nullable();
                    $t->timestamp('created_date')->nullable();
                    $t->timestamp('last_modified_date')->useCurrent();
                    $t->integer('created_by_id')->unsigned()->nullable();
                    $t->foreign('created_by_id')->references('id')->on('user')->onDelete($onDelete);
                    $t->integer('last_modified_by_id')->unsigned()->nullable();
                    $t->foreign('last_modified_by_id')->references('id')->on('user')->onDelete($onDelete);
                }
            );
        }
    }
540360
public function up()
    {
        Schema::create('mc_conversations', function (Blueprint $table) {
            $table->increments('id');
            $table->boolean('private')->default(true);
            $table->text('data')->nullable();
            $table->timestamps();
        });

        Schema::create('mc_messages', function (Blueprint $table) {
            $table->increments('id');
            $table->text('body');
            $table->integer('conversation_id')->unsigned();
            $table->integer('user_id')->unsigned();
            $table->string('type')->default('text');
            $table->timestamps();

            $table->foreign('user_id')
                ->references($this->userModelPrimaryKey)
                ->on($this->userModelTable)
                ->onDelete('cascade');

            $table->foreign('conversation_id')
                ->references('id')
                ->on('mc_conversations')
                ->onDelete('cascade');
        });

        Schema::create('mc_conversation_user', function (Blueprint $table) {
            $table->integer('user_id')->unsigned();
            $table->integer('conversation_id')->unsigned();
            $table->primary(['user_id', 'conversation_id']);
            $table->timestamps();

            $table->foreign('conversation_id')
                ->references('id')->on('mc_conversations')
                ->onDelete('cascade');

            $table->foreign('user_id')
                ->references($this->userModelPrimaryKey)
                ->on($this->userModelTable)
                ->onDelete('cascade');
        });

        Schema::create('mc_message_notification', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('message_id')->unsigned();
            $table->integer('conversation_id')->unsigned();
            $table->integer('user_id')->unsigned();
            $table->boolean('is_seen')->default(false);
            $table->boolean('is_sender')->default(false);
            $table->boolean('flagged')->default(false);
            $table->timestamps();
            $table->softDeletes();

            $table->index(['user_id', 'message_id']);

            $table->foreign('message_id')
                ->references('id')->on('mc_messages')
                ->onDelete('cascade');

            $table->foreign('conversation_id')
                ->references('id')->on('mc_conversations')
                ->onDelete('cascade');

            $table->foreign('user_id')
                ->references($this->userModelPrimaryKey)
                ->on($this->userModelTable)
                ->onDelete('cascade');
        });
    }
1060081
public function up() {
		$db = Database::get();
		$result = $db->get_row('show table status where NAME="file"', []);

		if (isset($result['engine']) and $result['engine'] == 'InnoDB') {
			return;
		}
	
		if (isset($result['Engine']) and $result['Engine'] == 'InnoDB') {
            		return;
        	}

		$db->query("
			ALTER TABLE `file` ENGINE='InnoDB';
		", []);
	}
752384
public function change() {
		$table = $this->table('queue_processes');
		$table
			->addColumn('pid', 'string', ['null' => false, 'default' => null, 'length' => 30])
			->addColumn('created', 'datetime', ['null' => true, 'default' => null])
			->addColumn('modified', 'datetime', ['null' => true, 'default' => null])
			->save();
	}
1301324
public function up()
    {
        Schema::create('items', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('page_id')->unsigned();
            $table->morphs('element');
            $table->integer('position')->unsigned();
            #$table->integer('proceeding_position')->unsigned();
            $table->string('name')->nullable();
            $table->boolean('proceed')->nullable();
            $table->string('template')->nullable();
            $table->string('cssId')->nullable();
            $table->string('cssClass')->nullable();
            $table->string('validation')->nullable();
            $table->nullableTimestamps();
            #$table->unique(['page_id', 'name']);
        });
    }
98679
public function change()
    {
		$table = $this->table('comment');
        $table->addColumn('external', 'boolean', array(
            'null' => false,
            'after' => 'article',
			'default' => 0,
		))
		->addColumn('pending', 'boolean', array(
            'null' => false,
            'after' => 'active',
			'default' => 0,
			'comment' => 'Pending approval',
        ))
        ->addColumn('spam', 'boolean', array(
            'null' => false,
            'after' => 'active',
			'default' => 0,
        ))
        ->addColumn('name', 'string', array(
            'null' => true,
            'after' => 'user',
            'length' => 32,
        ))
        ->addColumn('ip', 'string', array(
            'null' => true,
            'after' => 'timestamp',
            'length' => 30,
        ))
        ->addColumn('referer', 'string', array(
            'null' => true,
            'after' => 'ip',
            'length' => 300,
        ))
        ->addColumn('useragent', 'string', array(
            'null' => true,
            'after' => 'referer',
            'length' => 300,
        ))
        ->addColumn('email', 'string', array(
            'null' => true,
            'after' => 'useragent',
            'length' => 300,
        ))
		->addIndex(array('name'))
		->addIndex(array('pending'))
        ->save(); 
    }
611017
public function up()
    {
        Schema::table('page_versions', function (Blueprint $table) {
            $table->renameColumn('edited_time', 'created_at');
            $table->renameColumn('edited_by', 'created_by');
        });

        Schema::table('asset_versions', function (Blueprint $table) {
            $table->renameColumn('edited_at', 'created_at');
            $table->renameColumn('edited_by', 'created_by');
        });

        Schema::table('assets', function (Blueprint $table) {
            $table->renameColumn('uploaded_time', 'created_at');
            $table->renameColumn('uploaded_by', 'created_by');
        });

        Schema::table('pages', function (Blueprint $table) {
            $table->renameColumn('created_time', 'created_at');
        });
    }
548868
public function change()
	{
		$this->table('database_logs')
			->changeColumn('ip', 'string', [
				'default' => null,
				'limit' => 100,
				'null' => true,
			])
			->changeColumn('hostname', 'string', [
				'default' => null,
				'limit' => 100,
				'null' => true,
			])
			->changeColumn('created', 'datetime', [
				'default' => null,
				'null' => false,
			])->update();
	}
1326436
public function change()
    {
        if ($this->validate()) {
            /* @var $user User */
            $user = Yii::$app->user->identity;
            $user->setPassword($this->newPassword);
            $user->generateAuthKey();
            if ($user->save()) {
                return true;
            }
        }

        return false;
    }
581389
public function changename()
    {
        $soxId = $this->getEditObjectId();
        $aParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editval");

        $this->resetContentCache();

        $oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
        if ($soxId != "-1") {
            $oArticle->loadInLang($this->_iEditLang, $soxId);
        }

        $oArticle->setLanguage(0);
        $oArticle->assign($aParams);
        $oArticle->setLanguage($this->_iEditLang);
        $oArticle->save();
    }
409171
public function up()
    {
        Schema::table('changes', function (Blueprint $table) {
            $table->integer('admin_id')->unsigned()->nullable()->change();
        });
        Schema::table('changes', function (Blueprint $table) {
            $table->dropForeign(['admin_id']);
        });
        Schema::table('changes', function (Blueprint $table) {
            $table->foreign('admin_id')
                ->references('id')->on('admins')
                ->onUpdate('cascade')
                ->onDelete('set null');
        });
    }
404472
public function up()
	{
		if(Schema::hasColumn('001_026_field', 'field_type_026'))
		{
			// change column name
			DB::select(DB::raw('ALTER TABLE 001_026_field CHANGE field_type_026 field_type_id_026 TINYINT(3) UNSIGNED NOT NULL'));
		}

		if(Schema::hasColumn('001_026_field', 'field_type_text_026'))
		{
			// change column name
			DB::select(DB::raw('ALTER TABLE 001_026_field CHANGE field_type_text_026 field_type_name_026 VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL'));
		}

		if(Schema::hasColumn('001_026_field', 'data_type_026'))
		{
			// change column name
			DB::select(DB::raw('ALTER TABLE 001_026_field CHANGE data_type_026 data_type_id_026 TINYINT(3) UNSIGNED NOT NULL'));
		}

		if(Schema::hasColumn('001_026_field', 'data_type_text_026'))
		{
			// change column name
			DB::select(DB::raw('ALTER TABLE 001_026_field CHANGE data_type_text_026 data_type_name_026 VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL'));
		}

		if(Schema::hasColumn('001_028_field_result', 'data_type_028'))
		{
			// change column name
			DB::select(DB::raw('ALTER TABLE 001_028_field_result CHANGE data_type_028 data_type_type_028 VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL'));
		}
	}
475052
public function change() {
		$table = $this->table('queued_tasks');
		$table->addColumn('jobtype', 'string', ['length' => 45])
			->addColumn('data', 'text', ['null' => true])
			->addColumn('group', 'string', ['length' => 255, 'null' => true, 'default' => null])
			->addColumn('reference', 'string', ['length' => 255, 'null' => true, 'default' => null])
			->addColumn('created', 'datetime', ['null' => true, 'default' => null])
			->addColumn('notbefore', 'datetime', ['null' => true, 'default' => null])
			->addColumn('fetched', 'datetime', ['null' => true, 'default' => null])
			->addColumn('completed', 'datetime', ['null' => true, 'default' => null])
			->addColumn('progress', 'float', ['null' => true])
			->addColumn('failed', 'integer', ['default' => 0])
			->addColumn('failure_message', 'text', ['null' => true])
			->addColumn('workerkey', 'string', ['length' => 45, 'null' => true, 'default' => null])
			->create();
	}
126390
public function up()
    {
        //======
        // USERS
        //======
        // Either uncomment the section below to create the users table if it
        // was not already done before, or use it as an example for your own
        // migration.
//        // Create users table
//        Schema::create('users', function (Blueprint $table) {
//            $table->increments('id');
//            $table->string('first_name');
//            $table->string('last_name');
//            $table->string('username')->unique();
//            $table->string('email')->unique();
//            $table->string('password', 60);
//            $table->rememberToken();
//            $table->timestamps();
//        });

        // USERS: Add the auth_type column.
        Schema::table('users', function (Blueprint $table) {
            $table->string('auth_type')->nullable();
        });

        //=======
        // GROUPS
        //=======
        // Either uncomment the section below to create the groups table if it
        // was not already done before, or use it as an example for your own
        // migration.
//        // Create table for storing groups
//        Schema::create('groups', function (Blueprint $table) {
//            $table->increments('id');
//            $table->string('name')->unique();
//            $table->string('display_name')->nullable();
//            $table->string('description')->nullable();
//            $table->timestamps();
//        });
//
//        // Create table for associating groups to users (Many-to-Many)
//        Schema::create('group_user', function (Blueprint $table) {
//            $table->integer('user_id')->unsigned();
//            $table->integer('group_id')->unsigned();
//
//            $table->foreign('user_id')->references('id')->on('users')
//                ->onUpdate('cascade')->onDelete('cascade');
//            $table->foreign('group_id')->references('id')->on('groups')
//                ->onUpdate('cascade')->onDelete('cascade');
//
//            $table->primary(['user_id', 'group_id']);
//        });

        // GROUPS: Add the resync_on_login column.
        Schema::table('groups', function (Blueprint $table) {
            $table->boolean('resync_on_login')->default(false);
        });


    }
537493
public function migrateUp()
    {
        try {
            $this->builder->table(
                $this->table,
                function ($table) {
                    $table->string('value')->nullable()->change();
                }
            );
        } catch (\Exception $e) {
            dd($e->getMessage());
        }
    }
814533
public function up()
    {
        Schema::create('content_elements', function (Blueprint $table) {
            $table->increments('id');
            $table->string('type', 20)->nullable();
            $table->string('html')->nullable()->default(null);
            $table->string('html_tag')->nullable()->default(null);
            $table->enum('wrapper_type', ['begin', 'end'])->nullable()->default(null);
            $table->string('label')->nullable()->default(null);
            $table->string('form_input_type', 20)->nullable()->default(null);
            $table->text('html_attributes')->nullable()->default(null);
            $table->text('form_options')->nullable()->default(null);
            $table->string('form_validation')->nullable()->default('string');

            $table->nullableTimestamps();
        });
    }