public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
        $version = $context->getVersion();

        if (!$version) {
            return;
        }

        $oldConfigPaths = [
            'stale_ttl'                 => 'system/full_page_cache/fastly/stale_ttl',
            'stale_error_ttl'           => 'system/full_page_cache/fastly/stale_error_ttl',
            'purge_catalog_category'    => 'system/full_page_cache/fastly/purge_catalog_category',
            'purge_catalog_product'     => 'system/full_page_cache/fastly/purge_catalog_product',
            'purge_cms_page'            => 'system/full_page_cache/fastly/purge_cms_page',
            'soft_purge'                => 'system/full_page_cache/fastly/soft_purge',
            'enable_geoip'              => 'system/full_page_cache/fastly/enable_geoip',
            'geoip_action'              => 'system/full_page_cache/fastly/geoip_action',
            'geoip_country_mapping'     => 'system/full_page_cache/fastly/geoip_country_mapping',
        ];

        $newConfigPaths = [
            'stale_ttl'
                => 'system/full_page_cache/fastly/fastly_advanced_configuration/stale_ttl',
            'stale_error_ttl'
                => 'system/full_page_cache/fastly/fastly_advanced_configuration/stale_error_ttl',
            'purge_catalog_category'
                => 'system/full_page_cache/fastly/fastly_advanced_configuration/purge_catalog_category',
            'purge_catalog_product'
                => 'system/full_page_cache/fastly/fastly_advanced_configuration/purge_catalog_product',
            'purge_cms_page'
                => 'system/full_page_cache/fastly/fastly_advanced_configuration/purge_cms_page',
            'soft_purge'
                => 'system/full_page_cache/fastly/fastly_advanced_configuration/soft_purge',
            'enable_geoip'
                => 'system/full_page_cache/fastly/fastly_advanced_configuration/enable_geoip',
            'geoip_action'
                => 'system/full_page_cache/fastly/fastly_advanced_configuration/geoip_action',
            'geoip_country_mapping'
                => 'system/full_page_cache/fastly/fastly_advanced_configuration/geoip_country_mapping'
        ];

        $setup->startSetup();

        if (version_compare($version, '1.0.8', '<=')) {
            $this->upgrade108($oldConfigPaths, $newConfigPaths);
        }

        if (version_compare($version, '1.0.9', '<=')) {
            $this->upgrade109($setup);
        }

        // If Magento is upgraded later,
        // use bin/magento fastly:format:serializetojson OR /bin/magento fastly:format:jsontoserialize to adjust format
        $magVer = $this->productMetadata->getVersion();
        if (version_compare($version, '1.0.10', '<=') && version_compare($magVer, '2.2', '>=')) {
            $this->upgrade1010($newConfigPaths);
            $setup->endSetup();
        } elseif (version_compare($magVer, '2.2', '<')) {
            $setup->endSetup();
        }
    }