Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration Class Misnamed #5

Closed
dustinleblanc opened this issue Apr 23, 2019 · 2 comments
Closed

Migration Class Misnamed #5

dustinleblanc opened this issue Apr 23, 2019 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@dustinleblanc
Copy link

Describe the bug
Migration Class name doesn't respect the table name specified

To Reproduce
When generating a resource with:

laravel-craftsman craft:all Interest --model App/Models/Interest \
  --tablename interests \
  --rows 50 \
  --fields title:string,description:text:nullable

The following exception is thrown upon running php artisan migrate

  Symfony\Component\Debug\Exception\FatalThrowableError  : Class 'CreateInterestsTable' not found

  at /Users/dustinleblanc/Sites/wonderlore/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:419
    415|     public function resolve($file)
    416|     {
    417|         $class = Str::studly(implode('_', array_slice(explode('_', $file), 4)));
    418|
  > 419|         return new $class;
    420|     }
    421|
    422|     /**
    423|      * Get all of the migration files in a given path.

  Exception trace:

  1   Illuminate\Database\Migrations\Migrator::resolve("2019_04_23_112144_create_interests_table")
      /Users/dustinleblanc/Sites/wonderlore/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:169

  2   Illuminate\Database\Migrations\Migrator::runUp("/Users/dustinleblanc/Sites/wonderlore/database/migrations/2019_04_23_112144_create_interests_table.php")
      /Users/dustinleblanc/Sites/wonderlore/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:147

  Please use the argument -v to see more details.

Expected behavior
Running php artisan migrate after generation of a resource does not fail

Desktop (please complete the following information):

  • OS: OSX High Sierra, PHP 7.3 via brew

Was able to fix by renaming the generated class

@mikeerickson mikeerickson added the bug Something isn't working label Apr 23, 2019
@mikeerickson
Copy link
Owner

@dustinleblanc Thanks for the report, will fix this issue asap

@mikeerickson
Copy link
Owner

@dustinleblanc I have a fix ready, just need to wrap up a few more items i am planning for this release and it will be published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants