Answered by : indian-gooner
php artisan make:migration add_paid_to_users_table --table=users
public function up()
{ Schema::table('users', function($table) { $table->integer('paid'); });
}
public function down()
{ Schema::table('users', function($table) { $table->dropColumn('paid'); });
}
php artisan migrate
Source : https://stackoverflow.com/questions/16791613/add-a-new-column-to-existing-table-in-a-migration | Last Update : Thu, 10 Sep 20
Answered by : ahamba-solomon
php artisan make:migration add_paid_to_users_table --table=users
Source : https://stackoverflow.com/questions/16791613/add-a-new-column-to-existing-table-in-a-migration | Last Update : Tue, 27 Jul 21
Answered by : blushing-bear-zhodxoh6445m
php artisan make:migration add_paid_to_users_table --table=users
Source : https://stackoverflow.com/questions/16791613/add-a-new-column-to-existing-table-in-a-migration | Last Update : Thu, 07 May 20
Answered by : joyous-jaguar-ctnnk5onv031
//exemple :
//php artisan make:migration add_new_column_to_my_table_table --table=my_table
//php artisan make:migration add_login_to_users_table --table=users
public function up()
{ Schema::table('my_table', function($table) { $table->integer('new_column')->after('other_column_name'); //with after it's better to place it in your table });
}
public function down()
{ Schema::table('my_table', function($table) { $table->dropColumn('new_column'); });
}
Source : | Last Update : Tue, 09 Aug 22
Answered by : relieved-rook-b00akzjdnjdx
php artisan make:migration add_profile_to_users
Source : http://laravel-school.com/posts/how-to-add-new-columns-to-the-existing-table-in-laravel-migration-24 | Last Update : Mon, 15 Jun 20
Answered by : super-starling-627qnc5imhfr
Schema::table('table_name', function (Blueprint $table) { $table->string('column_name', 255)->nullable()->after('previous_column_name'); });
Source : | Last Update : Tue, 06 Oct 20