-- +goose Up
-- +goose StatementBegin
DROP INDEX IF EXISTS articles_fts_idx;
ALTER TABLE articles DROP COLUMN IF EXISTS fts_vector;
-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin
ALTER TABLE articles 
ADD COLUMN fts_vector tsvector GENERATED ALWAYS AS (
    to_tsvector('german', coalesce(title, '') || ' ' || coalesce(content, ''))
) STORED;

CREATE INDEX articles_fts_idx ON articles USING gin(fts_vector);
-- +goose StatementEnd