Alex Rivera | Logout

Laravel 4 migrate rollback problems

Asked 2013-06-18T16:43:27.387
73

I can easily run the artisan migrate etc, but when i try to roll it back, with migration:rollback i keep getting this error,

c:\xampp\htdocs\laravel>php artisan migrate:rollback
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'CreateCodesnippetsTable' not found","file":"C:\\xampp\\htdocs\\laravel\\vendor\\laravel\\framework\\src\\Illum
inate\\Database\\Migrations\\Migrator.php","line":301}}

Is this a bug? or how should i debug this?

Edit
Report

1 Answer

8

From what I can see I am guessing you have changed the class name manually. In the error you have the class name CreateCodesnippetsTable but in the migration file you provided (pastebin), the class name is CreateCodeSnippetsTable (notice the S in Snippets, I guess that is what you changed manually).

If you check the migrations table in your database you will see records for each migration. When you create the migration it will be saved in the database with that name and the rollback method tries to read the file with the name provided in the database, in the case when you change it manually laravel can't find the class and you get the error.

To fix this you can undo the changes and try to rollback or manually edit the migration row in your database to include the correct class name.

Hope this helps.

answered 2013-06-18T21:00:06.890

Your Answer