Doctrine\DBAL\Migrations\Configuration\Configuration::shouldExecuteMigration PHP Method

shouldExecuteMigration() private method

Check if we should execute a migration for a given direction and target migration version.
private shouldExecuteMigration ( string $direction, Version $version, string $to, array $migrated ) : boolean
$direction string The direction we are migrating.
$version Doctrine\DBAL\Migrations\Version The Version instance to check.
$to string The version we are migrating to.
$migrated array Migrated versions array.
return boolean
    private function shouldExecuteMigration($direction, Version $version, $to, $migrated)
    {
        if ($direction === Version::DIRECTION_DOWN) {
            if (!in_array($version->getVersion(), $migrated)) {
                return false;
            }
            return $version->getVersion() > $to;
        }
        if ($direction === Version::DIRECTION_UP) {
            if (in_array($version->getVersion(), $migrated)) {
                return false;
            }
            return $version->getVersion() <= $to;
        }
    }