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 of workbench package does not work. #44

Closed
buhl opened this issue Jan 15, 2013 · 6 comments
Closed

Migration of workbench package does not work. #44

buhl opened this issue Jan 15, 2013 · 6 comments

Comments

@buhl
Copy link

buhl commented Jan 15, 2013

running

php artisan migrate --bench=vendor/package

fails with

PHP Fatal error:  Class 'CreateContentTables' not found in /home/mgb/src/laravel4/laravel/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php on line 290
PHP Stack trace:
PHP   1. {main}() /home/mgb/src/laravel4/laravel/artisan:0
PHP   2. Symfony\Component\Console\Application->run() /home/mgb/src/laravel4/laravel/artisan:73
PHP   3. Symfony\Component\Console\Application->doRun() /home/mgb/src/laravel4/laravel/vendor/symfony/console/Symfony/Component/Console/Application.php:106
PHP   4. Illuminate\Console\Command->run() /home/mgb/src/laravel4/laravel/vendor/symfony/console/Symfony/Component/Console/Application.php:193
PHP   5. Symfony\Component\Console\Command\Command->run() /home/mgb/src/laravel4/laravel/vendor/laravel/framework/src/Illuminate/Console/Command.php:95
PHP   6. Illuminate\Console\Command->execute() /home/mgb/src/laravel4/laravel/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:240
PHP   7. Illuminate\Database\Console\Migrations\MigrateCommand->fire() /home/mgb/src/laravel4/laravel/vendor/laravel/framework/src/Illuminate/Console/Command.php:107
PHP   8. Illuminate\Database\Migrations\Migrator->run() /home/mgb/src/laravel4/laravel/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php:67
PHP   9. Illuminate\Database\Migrations\Migrator->runMigrationList() /home/mgb/src/laravel4/laravel/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:84
PHP  10. Illuminate\Database\Migrations\Migrator->runUp() /home/mgb/src/laravel4/laravel/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:113
PHP  11. Illuminate\Database\Migrations\Migrator->resolve() /home/mgb/src/laravel4/laravel/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:130

if I add the path

workbench/vendor/package/src/migrations

To autoload.classmaps in composer.json it works fine.
I havn't tested it but I am sure composer packages in vendor/ will have the same problem.

@robclancy
Copy link
Contributor

You aren't meant to use bench like that, it is only used for your own workbenches. In this case I believe you use ./artisan migrate --package=vendor/package

@buhl
Copy link
Author

buhl commented Jan 15, 2013

Sorry for the confusion. This is my own WIP package. I run

php artisan migrate --bench=buhl/content

the problem seems to lie here:
https://github.com/laravel/framework/blob/master/src/Illuminate/Database/Migrations/Migrator.php#L284

the Migrator->resolve($file) method is not aware of workbench or vendor paths and will look for (in my case) \CreateContentTables which can't be resolved unless I add the migration folder to composer.json classmaps directive.

@robclancy
Copy link
Contributor

Ah alright, I am still waking up and read your command a bit wrong. If I get a chance I will test to see if I have the same issue later.

@jasonlewis
Copy link
Contributor

Yeah mate it should work fine. Make sure your package in your workbench has src/migrations in the classmap of composer.json. Then cd workbench/<vendor>/<package> and run a composer dump-autoload. The workbench service should pick up the autoload file and also autoload everything within your package so you'll be able to run migrations.

I can confirm that running migrations within a workbench package is working.

@ghost
Copy link

ghost commented Jan 15, 2013

It is work fine for me

@buhl
Copy link
Author

buhl commented Jan 15, 2013

Yeah, that worked for me too. I forgot the composer dump-autoload in workbench//.
Thanks!

@buhl buhl closed this as completed Jan 15, 2013
dbpolito pushed a commit to dbpolito/framework that referenced this issue Oct 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants