-- Full-text search on cards
-- Generated tsvector column + GIN index for fast searching

ALTER TABLE cards ADD COLUMN IF NOT EXISTS search_vector tsvector
  GENERATED ALWAYS AS (
    to_tsvector('english', coalesce(title, '') || ' ' || coalesce(description, ''))
  ) STORED;

CREATE INDEX IF NOT EXISTS cards_search_idx ON cards USING gin(search_vector);
