diff --git a/internal/repository/product_repository.go b/internal/repository/product_repository.go index f3675ee..9c7f7f6 100644 --- a/internal/repository/product_repository.go +++ b/internal/repository/product_repository.go @@ -426,7 +426,8 @@ CREATE TABLE IF NOT EXISTS product.product_category ( updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), deleted_at TIMESTAMPTZ ); -CREATE UNIQUE INDEX IF NOT EXISTS uq_product_category_active_parent_name + +CREATE INDEX IF NOT EXISTS idx_product_category_active_parent_name ON product.product_category (COALESCE(parent_id, 0), lower(btrim(name))) WHERE deleted_at IS NULL; CREATE INDEX IF NOT EXISTS idx_product_category_active_parent_priority ON product.product_category (parent_id, priority, id) WHERE deleted_at IS NULL;