jcadima
4/29/2017 - 3:13 PM

Add new column to existing table

Add new column to existing table


https://stackoverflow.com/questions/16791613/add-a-new-column-to-existing-table-in-a-migration

1) add "published_at" field to existing events table:
php artisan make:migration add_published_at_to_events_table --table=events


2) In the new migration table, the after() method can be chained to specify the order of this new field (MySQL only)
will default to end of table
Schema::table('events', function (Blueprint $table) {
    $table->dateTime('published_at')->after('event_date')->nullable() ;
});


3) php artisan migrate