Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 protected function configure()
 {
     parent::configure();
     $this->setName('cleanup')->setDescription('Cleanup LHM tables, old archives and triggers')->setHelp(sprintf('%sCleanup LHM tables, old archives and triggers. Defaults to a dry-run unless --run is specified.%s', PHP_EOL, PHP_EOL));
     $this->addOption('--environment', '-e', InputOption::VALUE_REQUIRED, 'The target environment');
     // Apply operations
     $this->addOption('--run', 'r', InputOption::VALUE_NONE, 'Apply the cleanup operations.');
     // Archives older than the specified UTC date + time will be dropped.
     $this->addOption('--until', 'u', InputOption::VALUE_REQUIRED, 'Drop archive tables older than the specified date at UTC (YYYY-MM-DD_hh:mm:ss).');
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 protected function configure()
 {
     parent::configure();
     $this->setName('create')->setDescription('Create a new migration')->addArgument('name', InputArgument::REQUIRED, 'What is the name of the migration?')->setHelp(sprintf('%sCreates a new database migration%s', PHP_EOL, PHP_EOL));
     // An alternative template.
     $this->addOption('template', 't', InputOption::VALUE_REQUIRED, 'Use an alternative template');
     // A classname to be used to gain access to the template content as well as the ability to
     // have a callback once the migration file has been created.
     $this->addOption('class', 'l', InputOption::VALUE_REQUIRED, 'Use a class implementing "' . self::CREATION_INTERFACE . '" to generate the template');
 }
Ejemplo n.º 3
0
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->addOption('--environment', '-e', InputArgument::OPTIONAL, 'The target environment');
        $this->setName('status')->setDescription('Show migration status')->setHelp(<<<EOT
The <info>status</info> command prints a list of all migrations, along with their current status

<info>phinx status -e development</info>
EOT
);
    }
Ejemplo n.º 4
0
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->addOption('--environment', '-e', InputOption::VALUE_REQUIRED, 'The target environment.');
        $this->setName('status')->setDescription('Show migration status')->addOption('--format', '-f', InputOption::VALUE_REQUIRED, 'The output format: text or json. Defaults to text.')->setHelp(<<<EOT
                The <info>status</info> command prints a list of all migrations, along with their current status

<info>phinx status -e development</info>
<info>phinx status -e development -f json</info>
EOT
);
    }
Ejemplo n.º 5
0
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->addOption('--environment', '-e', InputOption::VALUE_REQUIRED, 'The target environment');
        $this->setName('test')->setDescription('Verify the configuration file')->setHelp(<<<EOT
\t\t\t\tThe <info>test</info> command verifies the YAML configuration file and optionally an environment

<info>phinx test</info>
<info>phinx test -e development</info>

EOT
);
    }
Ejemplo n.º 6
0
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->addOption('--environment', '-e', InputOption::VALUE_REQUIRED, 'The target environment');
        $this->setName('seed:run')->setDescription('Run database seeders')->addOption('--seed', '-s', InputOption::VALUE_REQUIRED, 'What is the name of the seeder?')->setHelp(<<<EOT
\t\t\t\tThe <info>seed:run</info> command runs all available or individual seeders

<info>phinx seed:run -e development</info>
<info>phinx seed:run -e development -s UserSeeder</info>
<info>phinx seed:run -e development -v</info>

EOT
);
    }
Ejemplo n.º 7
0
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->addOption('--environment', '-e', InputArgument::OPTIONAL, 'The target environment');
        $this->setName('rollback')->setDescription('Rollback the last or to a specific migration')->addOption('--target', '-t', InputArgument::OPTIONAL, 'The version number to rollback to')->setHelp(<<<EOT
The <info>rollback</info> command reverts the last migration, or optionally up to a specific version

<info>phinx rollback -e development</info>
<info>phinx rollback -e development -t 20111018185412</info>
<info>phinx rollback -e development -v</info>

EOT
);
    }
Ejemplo n.º 8
0
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->addOption('--environment', '-e', InputArgument::OPTIONAL, 'The target environment');
        $this->setName('migrate')->setDescription('Migrate the database')->addOption('--target', '-t', InputArgument::OPTIONAL, 'The version number to migrate to')->setHelp(<<<EOT
The <info>migrate</info> command runs all available migrations, optionally up to a specific version

<info>phinx migrate -e development</info>
<info>phinx migrate -e development -t 20110103081132</info>
<info>phinx migrate -e development -v</info>

EOT
);
    }
Ejemplo n.º 9
0
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->addOption('--environment', '-e', InputOption::VALUE_REQUIRED, 'The target environment.');
        $this->setName('breakpoint')->setDescription('Manage breakpoints')->addOption('--target', '-t', InputOption::VALUE_REQUIRED, 'The version number to set or clear a breakpoint against')->addOption('--remove-all', '-r', InputOption::VALUE_NONE, 'Remove all breakpoints')->setHelp(<<<EOT
The <info>breakpoint</info> command allows you to set or clear a breakpoint against a specific target to inhibit rollbacks beyond a certain target.
If no target is supplied then the most recent migration will be used.
You cannot specify un-migrated targets

<info>phinx breakpoint -e development</info>
<info>phinx breakpoint -e development -t 20110103081132</info>
<info>phinx breakpoint -e development -r</info>
EOT
);
    }
Ejemplo n.º 10
0
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->addOption('--environment', '-e', InputOption::VALUE_REQUIRED, 'The target environment');
        $this->setName('rollback')->setDescription('Rollback the last or to a specific migration')->addOption('--target', '-t', InputOption::VALUE_REQUIRED, 'The version number to rollback to')->addOption('--date', '-d', InputOption::VALUE_REQUIRED, 'The date to rollback to')->addOption('--force', '-f', InputOption::VALUE_NONE, 'Force rollback to ignore breakpoints')->setHelp(<<<EOT
The <info>rollback</info> command reverts the last migration, or optionally up to a specific version

<info>phinx rollback -e development</info>
<info>phinx rollback -e development -t 20111018185412</info>
<info>phinx rollback -e development -d 20111018</info>
<info>phinx rollback -e development -v</info>
<info>phinx rollback -e development -t 20111018185412 -f</info>

If you have a breakpoint set, then you can rollback to target 0 and the rollbacks will stop at the breakpoint.
<info>phinx rollback -e development -t 0 </info>

EOT
);
    }
Ejemplo n.º 11
0
 public function locateConfigFile(InputInterface $input)
 {
     return parent::locateConfigFile($input);
 }
Ejemplo n.º 12
0
 /**
  * Configures the Spout console application.
  */
 protected function configure()
 {
     parent::configure();
     $this->setName('run-migration')->setDescription('Run migrations.')->addOption('--location', '-l', InputArgument::OPTIONAL, 'The location of migration files. (spout|local)')->addOption('--environment', '-e', InputArgument::OPTIONAL, 'The target environment')->addOption('--target', '-t', InputArgument::OPTIONAL, 'The version number to migrate to');
 }
Ejemplo n.º 13
0
 /**
  * {@inheritdoc}
  */
 protected function configure()
 {
     parent::configure();
     $this->setName('create')->setDescription('Create a new migration')->addArgument('name', InputArgument::REQUIRED, 'What is the name of the migration?')->setHelp(sprintf('%sCreates a new database migration%s', PHP_EOL, PHP_EOL));
 }
Ejemplo n.º 14
0
 /**
  * Executes given Phinx command
  *
  * @param  AbstractCommand $command
  * @param  array           $argv
  * @return void
  */
 private function runNamedCommand(AbstractCommand $command, array $argv)
 {
     $command->setConfig($this->config);
     $application = $this->getPhinxApplication();
     $application->add($command);
     $application->run(new ArgvInput($argv), new ConsoleOutput());
 }
Ejemplo n.º 15
0
 /**
  * @param Command\AbstractCommand $command
  *
  * @return Command\AbstractCommand
  */
 protected function getCommand(Command\AbstractCommand $command)
 {
     $command->setName('migrate:' . $command->getName());
     $command->setConfig($this->getConfiguration());
     return $command;
 }