1: <?php
2:
3: namespace Aurora\System\Console\Commands\Migrations;
4:
5: use Illuminate\Database\Migrations\MigrationRepositoryInterface;
6: use Symfony\Component\Console\Command\Command;
7: use Symfony\Component\Console\Input\InputInterface;
8: use Symfony\Component\Console\Input\InputOption;
9: use Symfony\Component\Console\Output\OutputInterface;
10:
11: class InstallCommand extends Command
12: {
13: /**
14: * The repository instance.
15: *
16: * @var \Illuminate\Database\Migrations\MigrationRepositoryInterface
17: */
18: protected $repository;
19:
20: /**
21: * Create a new migration install command instance.
22: *
23: * @param \Illuminate\Database\Migrations\MigrationRepositoryInterface $repository
24: * @return void
25: */
26: public function __construct(MigrationRepositoryInterface $repository)
27: {
28: parent::__construct();
29:
30: $this->repository = $repository;
31: }
32:
33: protected function configure(): void
34: {
35: $this->setName('migrate:install')
36: ->setDescription('Create the migration repository')
37: ->addOption('database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use');
38: }
39:
40: protected function execute(InputInterface $input, OutputInterface $output): int
41: {
42: $this->repository->setSource($input->getOption('database'));
43:
44: $this->repository->createRepository();
45:
46: $output->writeln('Migration table created successfully.');
47:
48: return Command::SUCCESS;
49: }
50: }
51: