Why is the url the only unique index on spy_url?


If you check indexes in spy_url there is:

CREATE UNIQUE INDEX spy_url_unique_key ON public.spy_url USING btree (url)

The importer process filters the corresponding ID by url AND locale id.
And it totally makes sense to have same URL for dfferent languages of the same entity.

why is the url unique alone then? shouldn’t this be joined index from fk_locale+url ?


Hi Jan,

the original concept was to have URLs unique even across different locales. The keys for the Redis entries contain the URLs as well and one URL should represent only one thing and other environmental data (such as locale in session, etc.) shouldn’t affect what’s behind the URLs.

Best regards,
Spryker Support Team


@tvalerii thanks a lot for your info, but I think that statement stands in contrary to the Spryker reference implementation of the StorageRouter found in https://github.com/spryker-shop/shop-router/blob/master/src/SprykerShop/Yves/ShopRouter/Plugin/Router/StorageRouter.php#L70
hence, the key builder used to build the url keys https://github.com/spryker/key-builder/blob/master/src/Spryker/Shared/KeyBuilder/KeyBuilderTrait.php#L47

Could you eventually shed some light on the general approach of Spryker on whether URLs should be locale specific or not?


Hi Christoph,

URLs should be different for a specific entity for different locales (i.e. Product #123 english URL: /en/product-123; german URL: /de/product-123).

Best regards,
Spryker Support Team