-- Adds category property storage and allows group names to repeat under -- different parents. Run this migration before deploying the application. ALTER TABLE product.products ADD COLUMN IF NOT EXISTS category_properties JSONB NOT NULL DEFAULT '{}'::JSONB; DROP INDEX IF EXISTS product.uq_product_category_group_normalized_name; CREATE UNIQUE INDEX IF NOT EXISTS uq_product_category_group_normalized_name ON product.catalog_category ( store_id, COALESCE(parent_id, 0), lower(btrim(regexp_replace(translate(name, ' ', ' '), '[[:space:]]+', ' ', 'g'))) ) WHERE node_type = 2;