I am running a migration to rename a table but I get an odd error.
public function up()
{
Schema::rename($accounts, $feeds);
}
public function down()
{
Schema::rename($feeds, $accounts);
}
Error:
Undefined variable: accounts
Table definitely exists. Any idea what might be the issue?
Yes, you can name them however you want, but they will run in alphabetical order (which is why laravel timestamps them). Also you can change a migrations name after the fact (you've already run the migration).
You should use string and not variable:
public function up()
{
Schema::rename('accounts', 'feeds');
}
public function down()
{
Schema::rename('feeds', 'accounts');
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With