MigrateDatabaseCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Potievdev\SlimRbac\Console\Command;
4
5
use Potievdev\SlimRbac\Exception\ConfigNotFoundException;
6
use Potievdev\SlimRbac\Exception\NotSupportedDatabaseException;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
use Phinx\Migration\Manager;
10
11
/**
12
 * Class MigrateCommand
13
 * @package Potievdev\SlimRbac\Command
14
 */
15
class MigrateDatabaseCommand extends BaseDatabaseCommand
16
{
17
    public function configure()
18
    {
19
        $this
20
            ->setName('migrate')
21
            ->setDescription('Applies migrations to database');
22
    }
23
24
    /**
25
     * @param InputInterface $input
26
     * @param OutputInterface $output
27
     * @return void
28
     * @throws ConfigNotFoundException
29
     * @throws NotSupportedDatabaseException
30
     */
31
    public function execute(InputInterface $input, OutputInterface $output): void
32
    {
33
        parent::execute($input, $output);
34
        $manager = new Manager($this->config, $input, $output);
35
        $manager->migrate($this->config->getDefaultEnvironment());
36
    }
37
}
38