Ë
    ëJ­jQ  ã                   ó8   — d Z ddlmZ dZdZdZdZdZd	d„Zd	d„Z	y)
a   Phrase library: sentences from past bottom lines and problem discussions.

Built from `forecasts` / `forecast_problems` by app.phrases.rebuild, so any
source that lands in those tables (Drupal archive now; NAC/AFP later) feeds it.

Revision ID: 0003
Revises: 0002
Create Date: 2026-09-18
é    )ÚopÚ0003Ú0002Na>  
CREATE TABLE phrases (
    id bigserial PRIMARY KEY,
    center_id integer NOT NULL REFERENCES centers(id) ON DELETE CASCADE,
    forecast_id integer NOT NULL REFERENCES forecasts(id) ON DELETE CASCADE,
    field text NOT NULL CHECK (field IN ('bottom_line', 'problem')),
    problem_types smallint[] NOT NULL DEFAULT '{}',
    likelihood smallint,
    size_max numeric(2,1),
    locations text[] NOT NULL DEFAULT '{}',
    text text NOT NULL,
    norm text NOT NULL,
    valid_date date NOT NULL,
    source text NOT NULL,
    guidance_era text NOT NULL,
    tsv tsvector GENERATED ALWAYS AS (to_tsvector('english', text)) STORED
);
CREATE INDEX phrases_center_field_idx ON phrases (center_id, field);
CREATE INDEX phrases_types_idx ON phrases USING gin (problem_types);
CREATE INDEX phrases_tsv_idx ON phrases USING gin (tsv);
c                  ó6   — t        j                  t        «       y )N)r   ÚexecuteÚUPGRADE© ó    ú:/var/www/avy-guidance/api/alembic/versions/0003_phrases.pyÚupgrader   )   s   € Ü‡J�JŒwÕr
   c                  ó.   — t        j                  d«       y )NzDROP TABLE phrases)r   r   r	   r
   r   Ú	downgrader   -   s   € Ü‡J�JÐ#Õ$r
   )ÚreturnN)
Ú__doc__Úalembicr   ÚrevisionÚdown_revisionÚbranch_labelsÚ
depends_onr   r   r   r	   r
   r   ú<module>r      s4   ðñõ à€Ø€Ø€Ø€
ð€ó.ô%r
   