0

My migration looks like this, but it doesn't seem to do anything, or even throw any errors:

public function up()
{
    Schema::table('my_table', function (Blueprint $table) {
        $table->unsignedInteger('id')
            ->first()
            ->change();
    });
}

I know you can do it when creating a column, like this:

$table->unsignedInteger('id')
    ->first();

It'd definitely be possible with a raw MySQL statement, but perhaps Laravel migrations simply doesn't support moving a column after it's been created?

FYI, using PHP 7.1, Laravel 5.7, and MariaDB/MySQL 5.5

Kyle Challis
  • 981
  • 2
  • 12
  • 28
  • If there is no data, drop column and create new. I presume there is still data you want to preserve, then you can use bit hacky way from [this](https://stackoverflow.com/questions/20340778/laravel-migration-re-organising-column-order#answer-42194661) answer. – Tpojka Mar 30 '19 at 00:59
  • 1
    Possible duplicate of [laravel migration re-organising column order](https://stackoverflow.com/questions/20340778/laravel-migration-re-organising-column-order) – Rwd Mar 30 '19 at 08:20

0 Answers0