Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

laravel migration re-organising column order

When you create a new column in a table you can use the ->after('column name') to dictate where it goes. How can I create a migration that re-orders the columns in the right order I want?

like image 993
user391986 Avatar asked Dec 03 '13 00:12

user391986


1 Answers

Try this, hope it help you to find right solution:

public function up() {      DB::statement("ALTER TABLE example MODIFY COLUMN foo DATE AFTER bar");  }  public function down() {      DB::statement("ALTER TABLE example MODIFY COLUMN foo DATE AFTER bar");  } 
like image 59
Odin Thunder Avatar answered Sep 24 '22 19:09

Odin Thunder