migrations-generator
migrations-generator copied to clipboard
Lumen
Hi there,
Is it possible to have migrations-generator in Lumen too?
trying to use it in Lumen but failed.
Here my composer.json looks like
Would have to investigate. Don't really use Lumen myself. But if you are able to fix it, submit a PR and I'll merge
php artisan migrate:generate
[Doctrine\DBAL\DBALException] Unknown database type json requested, Doctrine\DBAL\Platforms\MySqlPlatform may not support it.
Didn`t support type json ,my database is mysql version >=5.7 .
This doesn't seem to be related to Lumen though, but rather with Doctrine's support for the new MySQL JSON Types. Best to open a issue on Doctrine's repo.
Any update on whether we can use this with lumen?
I'm sure it would be possible. Seems like there might be one or two changes one might have to make. Let me know if you run into any problems.
Got it working in a Lumen (5.4.6) (Laravel Components 5.4.*)
Application.
Basically, Lumen is missing a few core methods that we are copy-pasting back from Laravel.
// bootstrap/app.php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| Here we will load the environment and create the application instance
| that serves as the central piece of this framework. We'll use this
| application as an "IoC" container and router for this framework.
|
*/
class Application extends Laravel\Lumen\Application
{
/**
* Get the path to the application configuration files.
*
* @param string $path Optionally, a path to append to the config path
* @return string
*/
public function configPath($path = '')
{
return $this->basePath.DIRECTORY_SEPARATOR.'config'.($path ? DIRECTORY_SEPARATOR.$path : $path);
}
}
if (!function_exists('config_path')) {
/**
* Get the configuration path.
*
* @param string $path
* @return string
*/
function config_path($path = '')
{
return app()->basePath() . '/config' . ($path ? '/' . $path : $path);
}
}
if (!function_exists('app_path')) {
/**
* Get the path to the application folder.
*
* @param string $path
* @return string
*/
function app_path($path = '')
{
return app('path') . ($path ? DIRECTORY_SEPARATOR . $path : $path);
}
}
class_alias('Illuminate\Support\Facades\Config', 'Config');
$app = new Application(
realpath(__DIR__.'/../')
);
// $app->withFacades();
$app->withEloquent();
Now running artisan migrate:generate
should work as expected in Lumen.
@nasrulhazim @Xethron Hope this helps!