|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
5
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
6
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
7
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
8
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
9
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
10
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
11
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
12
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
13
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
14
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
15
|
|
|
* |
|
16
|
|
|
* This software consists of voluntary contributions made by many individuals |
|
17
|
|
|
* and is licensed under the MIT license. For more information, see |
|
18
|
|
|
* <http://www.doctrine-project.org>. |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
namespace Baleen\Cli\CommandBus\Timeline; |
|
22
|
|
|
|
|
23
|
|
|
use Baleen\Migrations\Migration\Options; |
|
24
|
|
|
use Baleen\Migrations\Timeline; |
|
25
|
|
|
use Baleen\Migrations\Version; |
|
26
|
|
|
use Symfony\Component\Console\Command\Command; |
|
27
|
|
|
use Symfony\Component\Console\Input\InputArgument; |
|
28
|
|
|
use Symfony\Component\Console\Input\InputOption; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* Class MigrateMessage. |
|
32
|
|
|
* |
|
33
|
|
|
* @author Gabriel Somoza <[email protected]> |
|
34
|
|
|
*/ |
|
35
|
|
|
class MigrateMessage extends AbstractTimelineCommand |
|
36
|
|
|
{ |
|
37
|
|
|
const ARG_TARGET = 'target'; |
|
38
|
|
|
const OPT_STRATEGY = 'strategy'; |
|
39
|
|
|
const OPT_NOPROGRESS = 'no-progress'; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @inheritdoc |
|
43
|
|
|
*/ |
|
44
|
|
|
public static function configure(Command $command) |
|
45
|
|
|
{ |
|
46
|
|
|
parent::configure($command); |
|
47
|
|
|
|
|
48
|
|
|
$command |
|
49
|
|
|
->setName('timeline:migrate') |
|
50
|
|
|
->setAliases(['migrate']) |
|
51
|
|
|
->setDescription('Migrates all versions up (or down) to and including the specified target.') |
|
52
|
|
|
->addArgument(self::ARG_TARGET, InputArgument::OPTIONAL, 'The target version to migrate to.', 'latest') |
|
53
|
|
|
->addOption( |
|
54
|
|
|
self::OPT_NOPROGRESS, |
|
55
|
|
|
null, |
|
56
|
|
|
InputOption::VALUE_NONE, |
|
57
|
|
|
'Show a more detailed log instead of a progress bar.' |
|
58
|
|
|
)->addOption( |
|
59
|
|
|
self::OPT_STRATEGY, |
|
60
|
|
|
's', |
|
61
|
|
|
InputOption::VALUE_REQUIRED, |
|
62
|
|
|
'Strategy to migrate with (up/down/both).', |
|
63
|
|
|
Options::DIRECTION_UP // 'up' |
|
64
|
|
|
); |
|
65
|
|
|
} |
|
66
|
|
|
} |
|
67
|
|
|
|