Laravel4-Vagrant icon indicating copy to clipboard operation
Laravel4-Vagrant copied to clipboard

Migrate error [ErrorException] Undefined variable: table

Open MrDinsdale opened this issue 10 years ago • 8 comments

Hey,

Getting an error when running php artisan migrate:

[ErrorException]
Undefined variable: table

migrate [--bench[="..."]] [--database[="..."]] [--path[="..."]] [--package[="..."]] [--pretend] [--seed]

Not sure if its something i've done wrong but any suggestions would be appreciated!

Joe

MrDinsdale avatar Apr 10 '14 22:04 MrDinsdale

Hey Joe,

This sounds like an error in your Laravel migrations. I could take a quick look at them if you want to make a gist of your migration files (should be in app/database/migrations/) and send it over.

Thanks! -Bryan

bryannielsen avatar Apr 16 '14 12:04 bryannielsen

You probably forgot to wrap you column generators in Schema::create('users', function($table) {});

andreas-bergstrom avatar Aug 17 '14 10:08 andreas-bergstrom

Look in your migrations files.. Maybe you use the variable $table but need to use $Table (T uppercase?)

salvaracer avatar Oct 19 '14 21:10 salvaracer

Look table function does not exist Use Schema::create('users', function($table)

cveranoa avatar Oct 26 '14 04:10 cveranoa

@MrDinsdale It can even happen if you've added dropForiegn() or dropColumn() methods unnecessarily in your down() method for a Create Table Migration.

droidchef avatar Jan 14 '15 06:01 droidchef

@MrDinsdale maybe the foreign key that you wrote is outside the schema{}

rhezav95 avatar May 09 '16 11:05 rhezav95

@MrDinsdale In my case solution is this: http://larabrain.com/tips/debugging-laravel-migrations-using-verbose-output

dib90 avatar May 10 '17 12:05 dib90

Mercii cette Astuce m'a bien aidé dib90

YvesBoah avatar Oct 10 '17 01:10 YvesBoah