Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ protected function runMigrations()
protected function prepareDatabase()
{
if (! $this->repositoryExists()) {
$this->components->info('Preparing database.');
$this->components->info(sprintf(
'Preparing %s database.',
$this->migrator->resolveConnection($this->option('database'))->getDriverName()
));

$this->components->task('Creating migration table', function () {
return $this->callSilent('migrate:install', array_filter([
Expand Down
4 changes: 4 additions & 0 deletions tests/Database/DatabaseMigrationMigrateCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Console\CommandMutex;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Database\Connection;
use Illuminate\Database\Console\Migrations\MigrateCommand;
use Illuminate\Database\Events\SchemaLoaded;
use Illuminate\Database\Migrations\Migrator;
Expand Down Expand Up @@ -69,12 +70,15 @@ public function testMigrationsCanBeRunWithStoredSchema()
public function testMigrationRepositoryCreatedWhenNecessary()
{
$params = [$migrator = m::mock(Migrator::class), $dispatcher = m::mock(Dispatcher::class)];
$connectionMock = m::mock(Connection::class);
$connectionMock->shouldReceive('getDriverName')->andReturn('mysql');
$command = $this->getMockBuilder(MigrateCommand::class)->onlyMethods(['callSilent'])->setConstructorArgs($params)->getMock();
$app = new ApplicationDatabaseMigrationStub(['path.database' => __DIR__]);
$app->useDatabasePath(__DIR__);
$command->setLaravel($app);
$migrator->shouldReceive('paths')->once()->andReturn([]);
$migrator->shouldReceive('hasRunAnyMigrations')->andReturn(true);
$migrator->shouldReceive('resolveConnection')->andReturn($connectionMock);
$migrator->shouldReceive('usingConnection')->once()->andReturnUsing(function ($name, $callback) {
return $callback();
});
Expand Down