PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, February 21, 2022

[FIXED] Laravel Migration to change table name

 February 21, 2022     laravel, laravel-5     No comments   

Issue

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.


Solution

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.



Answered By - GWed
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing