-- migrate:up
create table if not exists product_aliases (
  tenant_id uuid not null references tenants(id) on delete cascade,
  alias text not null,
  normalized_alias text not null,
  woo_product_id integer null,
  category_hint text null,
  boost numeric(6,3) not null default 0.0,
  metadata jsonb not null default '{}'::jsonb,
  created_at timestamptz not null default now(),
  updated_at timestamptz not null default now(),
  primary key (tenant_id, alias)
);

create index if not exists product_aliases_tenant_norm_idx
  on product_aliases (tenant_id, normalized_alias);

-- migrate:down
drop table if exists product_aliases;
