Skip to content
Merged
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 @@ -6,14 +6,11 @@

use Tempest\Console\Console;
use Tempest\Console\Input\ConsoleArgumentBag;
use Tempest\Container\Container;
use Tempest\Core\Installer;
use Tempest\Core\PublishesFiles;
use Tempest\Database\Migrations\MigrationManager;

use function Tempest\root_path;
use function Tempest\src_path;
use function Tempest\Support\Namespace\to_fqcn;

final class DatabaseSessionInstaller implements Installer
{
Expand All @@ -23,7 +20,6 @@ final class DatabaseSessionInstaller implements Installer

public function __construct(
private readonly MigrationManager $migrationManager,
private readonly Container $container,
private readonly Console $console,
private readonly ConsoleArgumentBag $consoleArgumentBag,
) {}
Expand All @@ -43,9 +39,7 @@ public function install(): void
$this->publishImports();

if ($migration && $this->shouldMigrate()) {
$this->migrationManager->executeUp(
migration: $this->container->get(to_fqcn($migration, root: root_path())),
);
$this->migrationManager->up();
}
}

Expand All @@ -54,7 +48,7 @@ private function shouldMigrate(): bool
$argument = $this->consoleArgumentBag->get('migrate');

if ($argument === null || ! is_bool($argument->value)) {
return $this->console->confirm('Do you want to execute migrations?', default: false);
return $this->console->confirm('Do you want to execute migrations?');
}

return (bool) $argument->value;
Expand Down
Loading