Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 12
MigrateTo
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 2
12
0.00% covered (danger)
0.00%
0 / 12
 prepare
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 4
 migrate
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 8
<?php namespace App\Commands;
use Framework\CLI\CLI;
use Framework\Database\Extra\Migrator;
class MigrateTo extends AbstractMigration
{
    protected string $name = 'migrate:to';
    protected string $description = 'Run migrations to specific version.';
    protected string $usage = 'migrate:to [version]';
    protected function prepare()
    {
        parent::prepare();
        $this->description = $this->console->getLanguage()->render('migrations', 'runTo');
    }
    protected function migrate(Migrator $migrator) : void
    {
        $to_version = $arguments[0] ?? CLI::prompt('Version');
        foreach ($migrator->migrateTo($to_version) as $version) {
            CLI::write(
                $this->console->getLanguage()->render('migration', 'migratedToVersion', [$version])
            );
        }
    }
}