Schema::table('users', function (Blueprint $table) {
$table->renameColumn('from', 'to');
});
php artisan make:migration rename_table-name_column
up(){
Schema::table('table-name', function(Blueprint $table){
$table->renameColumn('old-name', 'new-name');
});
}
down(){
Schema::table('table-name', function(Blueprint $table) {
$table->renameColumn('new-name', 'old-name');
});
}
Schema::rename($currentTableName, $newTableName);
php artisan make:migration rename_author_id_in_posts_table --table=posts
public function up()
{
Schema::table('posts', function (Blueprint $table) {
$table->renameColumn('author_ID', 'user_id');
});
}
php artisan make:migration alter_your_table --table=your_table
Schema::rename('oldTablename', 'newTableName');
public function down()
{
Schema::table('posts', function (Blueprint $table) {
$table->renameColumn('user_id', 'author_ID');
});
}