protected function checkInstalledVersion($installed_version, array $definition_versions)
    {
        if ($installed_version === null) {
            $this->error('Nothing installed version.');
            $this->line('Please run <comment>database:upgrade<comment>.');

            return false;
        }

        $index = array_search($installed_version, array_keys($definition_versions));

        if ($index === false) {
            $versions = json_encode(array_keys($definition_versions));
            $this->error("Installed version '{$installed_version}' was not found in definition {$versions}.");

            return false;
        }

        if ($index >= 2) {
            $this->error("Installed version '$installed_version' was older.");
            $this->line('Please run <comment>database:upgrade<comment>.');

            return false;
        }

        return true;
    }