Files
botino/db/migrations/20260118100000_reco_rules_product_ids.sql
2026-01-17 06:31:49 -03:00

16 lines
653 B
SQL

-- migrate:up
-- Agregar columnas para asociación directa producto-producto
alter table product_reco_rules
add column if not exists trigger_product_ids integer[] not null default '{}',
add column if not exists recommended_product_ids integer[] not null default '{}';
-- Índice GIN para búsqueda rápida por trigger_product_ids
create index if not exists product_reco_rules_trigger_ids_idx
on product_reco_rules using gin (trigger_product_ids);
-- migrate:down
drop index if exists product_reco_rules_trigger_ids_idx;
alter table product_reco_rules
drop column if exists trigger_product_ids,
drop column if exists recommended_product_ids;