Oct.12

Adding Column in Existing Table Laravel (migration command code)

We can easily add remove existing column in existing table of our project. It is necessary to add column in exiting production database. Here i have share the steps to add column in existing table.

 

To create a migration, you may use the migrate:make command on the Artisan CLI. Use a specific name to avoid clashing with existing models

for Laravel 3:



php artisan migrate:make add_sankar_to_tbl_admin_menu1

 

for Laravel 5+:

php artisan make:migration add_sankar_to_tbl_admin_menu1

 

 

Here –>

add_ is prefix

sankar is column name

_to_  is        joiner

tbl_admin_menu1 is existing table name

 

use $table->integer('sankar')->after(whichever_column); to add this field after specific column.

 

 

 

Share this Story:
  • facebook
  • twitter
  • gplus

Leave a comment

Facebook Comment