Skip to content

Commit

Permalink
Fix migration rollbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
Repflez committed Sep 13, 2021
1 parent 7910f0b commit 62fe9a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/Console/Command/DatabaseRollbackCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
*/
class DatabaseRollbackCommand extends Command
{
/**
* The database migrations directory.
*/
private const MIGRATIONS = 'database/';

/**
* Set up the command metadata.
*/
Expand All @@ -38,7 +43,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$migrator = new Migrator($repository, $repository->getConnectionResolver(), new Filesystem());
$migrator->setOutput($output);

$migrator->rollback();
$migrator->rollback(path(self::MIGRATIONS));

return Command::SUCCESS;
}
Expand Down
4 changes: 2 additions & 2 deletions src/DB.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public static function connect(array $details) : void
*/
public static function getMigrationRepository() : DatabaseMigrationRepository
{
$resolver = new ConnectionResolver(['database' => self::connection()]);
$resolver = new ConnectionResolver(['' => self::connection()]);
$repository = new DatabaseMigrationRepository($resolver, 'migrations');
$repository->setSource('database');
$repository->setSource('');

return $repository;
}
Expand Down

0 comments on commit 62fe9a1

Please sign in to comment.