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 : sazzad-hossain-nirjhor-h1whv1vt0dd3
php artisan make:migration add_paid_to_users_table --table=users
public function up()
{ Schema::table('users', function($table) { $table->integer('paid')->after('status'); });
}
public function down()
{ Schema::table('users', function($table) { $table->dropColumn('paid'); });
}
php artisan migrate
Source : | Last Update : Mon, 20 Jun 22
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 : monodeep-roy
public function down()
{ Schema::table('users', function($table) { $table->dropColumn('paid'); });
}
Source : https://www.edureka.co/community/65622/how-add-new-column-to-existing-table-of-laravel-in-migration | Last Update : Wed, 26 Aug 20
Answered by : energetic-elk-qv5ck0sgo9bx
Schema::table('users', function (Blueprint $table) { $table->dateTime('verify_date')->nullable()->after("password_updated_at");
});
Source : | Last Update : Wed, 08 Apr 20
Answered by : yeasin-ahammed-apon
#single migration file create command
php artisan make:migration add_delivery_time_to_carts_table --table=carts
Source : | Last Update : Mon, 04 Apr 22
Answered by : tiago-bordin
{"tags":[{"tag":"textarea","content":"public function up()\n{\n Schema::table('users', function($table) {\n $table->integer('paid');\n });\n}\n\npublic function down()\n{\n Schema::table('users', function($table) {\n $table->dropColumn('paid');\n });\n}","code_language":"php"}]}
Source : https://stackoverflow.com/questions/16791613/laravel-add-a-new-column-to-existing-table-in-a-migration | Last Update : Thu, 09 Feb 23
Answered by : james-juson
// The table method on the Schema facade MAY BE USED TO UPDATE EXISTING TABLES.
// The table method accepts two arguments: the name of the table and a Closure
// that receives a Blueprint instance you may use to add columns to the table:
Schema::table('users', function (Blueprint $table) { $table->string('email');
});
Source : https://laravel.com/docs/7.x/migrations#creating-columns | Last Update : Mon, 25 Jan 21
Answered by : monodeep-roy
public function up()
{ Schema::table('users', function($table) { $table->integer('paid'); });
}
Source : https://www.edureka.co/community/65622/how-add-new-column-to-existing-table-of-laravel-in-migration | Last Update : Wed, 26 Aug 20