public function getMigrationsToExecute($direction, $to)
    {
        if ($direction === Version::DIRECTION_DOWN) {
            $this->throwMethodIsNotAllowedException('Migration down is not allowed.');
        }

        $migrationVersionsToExecute = [];
        $allMigrationVersions = $this->getMigrations();
        $migratedVersions = $this->getMigratedVersions();

        foreach ($allMigrationVersions as $version) {
            if ($to < $version->getVersion()) {
                $this->throwMethodIsNotAllowedException('Partial migration up in not allowed.');
            }

            if ($this->shouldExecuteMigration($version, $migratedVersions)) {
                $migrationVersionsToExecute[$version->getVersion()] = $version;
            }
        }

        return $migrationVersionsToExecute;
    }