From 0952651cf3498886dd23e17eed1e4527a46a5552 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Mon, 19 Oct 2015 16:48:16 +1030 Subject: [PATCH] Fix migrate command and generated migration namespace --- framework/core/src/Console/Server.php | 4 ++-- framework/core/src/Database/MigrationCreator.php | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/framework/core/src/Console/Server.php b/framework/core/src/Console/Server.php index f63d2d7e6..32fe3e29f 100644 --- a/framework/core/src/Console/Server.php +++ b/framework/core/src/Console/Server.php @@ -30,12 +30,12 @@ class Server extends AbstractServer { $app = $this->getApp(); - $console = new Application('Flarum', $app::VERSION); + $console = new Application('Flarum', $app->version()); $app->register('Flarum\Install\InstallServiceProvider'); $console->add($app->make('Flarum\Install\Console\InstallCommand')); - $console->add($app->make('Flarum\Console\Command\UpgradeCommand')); + $console->add($app->make('Flarum\Update\Console\MigrateCommand')); $console->add($app->make('Flarum\Console\Command\GenerateExtensionCommand')); $console->add($app->make('Flarum\Console\Command\GenerateMigrationCommand')); diff --git a/framework/core/src/Database/MigrationCreator.php b/framework/core/src/Database/MigrationCreator.php index 64f52f217..ce871807b 100755 --- a/framework/core/src/Database/MigrationCreator.php +++ b/framework/core/src/Database/MigrationCreator.php @@ -92,8 +92,10 @@ class MigrationCreator */ protected function populateStub($extension, $name, $stub, $table) { + list($vendor, $package) = explode('-', $extension, 2); + $replacements = [ - '{{namespace}}' => Str::studly($extension) ?: 'Flarum\Core', + '{{namespace}}' => Str::studly($vendor).'\\'.Str::studly($package) ?: 'Flarum\Core', '{{name}}' => Str::studly($name), '{{table}}' => $table ];