Laravel Migration to change table name

前端 未结 4 931
挽巷
挽巷 2020-12-08 05:57

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.

4条回答
  •  忘掉有多难
    2020-12-08 06:45

    To change a table name, you can do this:

    Schema::rename($currentTableName, $newTableName);
    

    You can use the drop or dropIfExists methods to remove an existing table:

    Schema::drop('users');
    
    Schema::dropIfExists('users');
    

    Just add that to a migration and it should work.

提交回复
热议问题