InfyOmLabs / laravel-generator

API and Admin Panel CRUD Generator for Laravel.
https://www.infyom.com/open-source
MIT License
3.78k stars 802 forks source link

Migrate:refresh and migrate:rollback error #209

Closed ObaidParacha closed 8 years ago

ObaidParacha commented 8 years ago

I create a scaffold through generator builder with datatables. It creates everything Model, Views, Datatables, Migration etc. But when I run migrate:refresh or migrate:rollback, it gives me error that

"[Symfony\Component\Debug\Exception\FatalThrowableError] class 'CreateStudentTable' not found"

Any solutions?'

edit: it gives error against latest migration, if CreateResultTable is last then it will give error on that.

mitulgolakiya commented 8 years ago

@mastermind23 Have you checked if original migration file is there ?

laurensclaessen commented 8 years ago

The migration template uses the lowercase table name Create$TABLE_NAME$Table to create the Class, but it should use the PascalCase Model name.

Changing it to Create$MODEL_NAME_PLURAL$Table will do the trick.

ObaidParacha commented 8 years ago

@mitulgolakiya Yes the original migration files exists. I have tested it multiple times and always it gives error with the name of the last migration.

ObaidParacha commented 8 years ago

vendor/infyomlabs/laravel-generator/templates/migration.stub Changed Create$MODEL_NAME_PLURAL$Table. worked fine issue resolved thus far, one of my migrations is giving same error, most probably some syntax error or something, i'll create new migration but my main issue have been resolved.

Thanx @laurensclaessen

ObaidParacha commented 8 years ago

again something went wrong with update of infyom.

previous all migrations are working fine and can rollback, but creating new model with generator-builder. it fails to migrate, also if i manually migrate that, the same issue returns where i can't rollback the latest migration

mitulgolakiya commented 8 years ago

@mastermind23, I was on a vacation. just came today. will review it and will fix it by this weekend.

ptsilva commented 8 years ago

@mitulgolakiya see #222, this PR fix this issue