@@ 37-72 (lines=36) @@ | ||
34 | */ |
|
35 | class ExecuteCommand extends AbstractCommand |
|
36 | { |
|
37 | protected function configure() |
|
38 | { |
|
39 | $this |
|
40 | ->setName('migrations:execute') |
|
41 | ->setDescription('Execute a single migration version up or down manually.') |
|
42 | ->addArgument('version', InputArgument::REQUIRED, 'The version to execute.', null) |
|
43 | ->addOption('write-sql', null, InputOption::VALUE_NONE, 'The path to output the migration SQL file instead of executing it.') |
|
44 | ->addOption('dry-run', null, InputOption::VALUE_NONE, 'Execute the migration as a dry run.') |
|
45 | ->addOption('up', null, InputOption::VALUE_NONE, 'Execute the migration up.') |
|
46 | ->addOption('down', null, InputOption::VALUE_NONE, 'Execute the migration down.') |
|
47 | ->addOption('query-time', null, InputOption::VALUE_NONE, 'Time all the queries individually.') |
|
48 | ->setHelp(<<<EOT |
|
49 | The <info>%command.name%</info> command executes a single migration version up or down manually: |
|
50 | ||
51 | <info>%command.full_name% YYYYMMDDHHMMSS</info> |
|
52 | ||
53 | If no <comment>--up</comment> or <comment>--down</comment> option is specified it defaults to up: |
|
54 | ||
55 | <info>%command.full_name% YYYYMMDDHHMMSS --down</info> |
|
56 | ||
57 | You can also execute the migration as a <comment>--dry-run</comment>: |
|
58 | ||
59 | <info>%command.full_name% YYYYMMDDHHMMSS --dry-run</info> |
|
60 | ||
61 | You can output the would be executed SQL statements to a file with <comment>--write-sql</comment>: |
|
62 | ||
63 | <info>%command.full_name% YYYYMMDDHHMMSS --write-sql</info> |
|
64 | ||
65 | Or you can also execute the migration without a warning message which you need to interact with: |
|
66 | ||
67 | <info>%command.full_name% YYYYMMDDHHMMSS --no-interaction</info> |
|
68 | EOT |
|
69 | ); |
|
70 | ||
71 | parent::configure(); |
|
72 | } |
|
73 | ||
74 | public function execute(InputInterface $input, OutputInterface $output) |
|
75 | { |
@@ 52-89 (lines=38) @@ | ||
49 | */ |
|
50 | private $markMigrated; |
|
51 | ||
52 | protected function configure() |
|
53 | { |
|
54 | $this |
|
55 | ->setName('migrations:version') |
|
56 | ->setDescription('Manually add and delete migration versions from the version table.') |
|
57 | ->addArgument('version', InputArgument::OPTIONAL, 'The version to add or delete.', null) |
|
58 | ->addOption('add', null, InputOption::VALUE_NONE, 'Add the specified version.') |
|
59 | ->addOption('delete', null, InputOption::VALUE_NONE, 'Delete the specified version.') |
|
60 | ->addOption('all', null, InputOption::VALUE_NONE, 'Apply to all the versions.') |
|
61 | ->addOption('range-from', null, InputOption::VALUE_OPTIONAL, 'Apply from specified version.') |
|
62 | ->addOption('range-to', null, InputOption::VALUE_OPTIONAL, 'Apply to specified version.') |
|
63 | ->setHelp(<<<EOT |
|
64 | The <info>%command.name%</info> command allows you to manually add, delete or synchronize migration versions from the version table: |
|
65 | ||
66 | <info>%command.full_name% YYYYMMDDHHMMSS --add</info> |
|
67 | ||
68 | If you want to delete a version you can use the <comment>--delete</comment> option: |
|
69 | ||
70 | <info>%command.full_name% YYYYMMDDHHMMSS --delete</info> |
|
71 | ||
72 | If you want to synchronize by adding or deleting all migration versions available in the version table you can use the <comment>--all</comment> option: |
|
73 | ||
74 | <info>%command.full_name% --add --all</info> |
|
75 | <info>%command.full_name% --delete --all</info> |
|
76 | ||
77 | If you want to synchronize by adding or deleting some range of migration versions available in the version table you can use the <comment>--range-from/--range-to</comment> option: |
|
78 | ||
79 | <info>%command.full_name% --add --range-from=YYYYMMDDHHMMSS --range-to=YYYYMMDDHHMMSS</info> |
|
80 | <info>%command.full_name% --delete --range-from=YYYYMMDDHHMMSS --range-to=YYYYMMDDHHMMSS</info> |
|
81 | ||
82 | You can also execute this command without a warning message which you need to interact with: |
|
83 | ||
84 | <info>%command.full_name% --no-interaction</info> |
|
85 | EOT |
|
86 | ); |
|
87 | ||
88 | parent::configure(); |
|
89 | } |
|
90 | ||
91 | public function execute(InputInterface $input, OutputInterface $output) |
|
92 | { |