mirror of
https://ids-dev.idsbuybuybuy.com/ids-ecommerce/ids-svc-product.git
synced 2026-11-29 16:57:41 +08:00
16 lines
620 B
SQL
16 lines
620 B
SQL
-- 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;
|