Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

how to migrate new column without empty the table in laravel

Use below command to modify the existing table

php artisan make:migration add_shipped_via_and_terms_colums_to_purchase_orders_table --table=purchase_orders
use --create for creating the new table and --table for modifying the existing table.

Now a new migration file will be created. Inside the up() function in this file add these line

Schema::table('purchase_orders', function(Blueprint $table){
    $table->string('shipped_via');
    $table->string('terms');
});
And then run php artisan migrate
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #migrate #column #empty #table #laravel
ADD COMMENT
Topic
Name
8+4 =