First of all, you need to install package dbal
.
composer require doctrine/dbal
When it's done, now you need to make one migration like this
php artisan make:migration rename_column_user_name_to_username_in_users_table --table=users
Now open that file inside migrations
folder and start to modify it.
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->renameColumn('user_name', 'username');
});
}
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->renameColumn('user_name', 'username');
});
}
Now you can migrate it php artisan migrate
And you're done.
Top comments (0)