Add a vanilla-creature filter to card and library search

Filtering for creatures with an empty rules box can't be done from
`oracle_cards.oracle_text`: that column joins every face together, so an
Adventure card always carries its spell half's text and a naive `oracle_text
= ''` test would exclude exactly the cards worth including.

Derive it at ingest instead, from the front face's own text — the front is the
half that resolves as the creature, and adventure/prepared/transform cards are
all cast from it. Exposed as `vanilla_only` behind its own `has_vanilla`
capability check rather than folded into `has_universes_beyond`, since it
lands in a later reference-schema revision and a db can have one column
without the other. Needs a card-data re-download before it does anything.
This commit is contained in:
2026-08-14 01:02:29 -05:00
parent d014609244
commit e3725cee55
7 changed files with 133 additions and 5 deletions

View File

@@ -44,7 +44,13 @@ CREATE TABLE IF NOT EXISTS oracle_cards (
-- "can't be compared numerically", and such cards drop out of a
-- power/toughness range filter rather than being coerced to 0.
power REAL,
toughness REAL
toughness REAL,
-- Boolean: a creature with no rules text whatsoever ("vanilla"). Derived at
-- ingest from the *front face* rather than from `oracle_text`, which joins
-- every face together — an Adventure or Prepared card's creature half can be
-- vanilla while the column still holds the attached spell's text, so the
-- property isn't recoverable from this table alone.
vanilla INTEGER NOT NULL DEFAULT 0
);
CREATE INDEX IF NOT EXISTS idx_oracle_name_lower ON oracle_cards(name_lower);
CREATE INDEX IF NOT EXISTS idx_oracle_ci ON oracle_cards(color_identity);