Laravel Migration to change table name
Question is . :
I want to change my two table name in the Laravel, so do I have to manually change the table name or it can be possible through migration.
To rename an existing database table, use the rename method:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
<?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Migrations\Migration; class ChangeUserTableName extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::rename('users','members'); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::rename('members','users'); } } |
Recent Comments