Prefer Scryfall's representative printing for default card images

Card previews were picking whichever printing happened to load first
during ingest (ORDER BY rowid over every printing, promos and foreign
versions included), so a card's default image was effectively random.
Capture the representative printing's images straight from the Oracle
Cards bulk pass instead, and prefer that over the old printings-table
guess, falling back gracefully on an older reference.db that predates
these columns.

Also add docs/printing-tracking-design.md, a design (not yet
implemented) for optionally tracking which specific printing/finish a
library or deck card is.
This commit is contained in:
2026-07-22 22:05:44 -05:00
parent aaf632a417
commit d3e8a8f25a
10 changed files with 331 additions and 16 deletions

View File

@@ -16,7 +16,15 @@ CREATE TABLE IF NOT EXISTS oracle_cards (
legalities INTEGER NOT NULL DEFAULT 0, -- 2 bits/format x 8 formats, see model::LEGALITY_FORMATS
themes INTEGER NOT NULL DEFAULT 0, -- archetype bitmask, see synergy::ARCHETYPES
edhrec_rank INTEGER, -- Scryfall EDHREC popularity rank; NULL if unranked
horizontal INTEGER NOT NULL DEFAULT 0 -- boolean: printed/displayed sideways (Scryfall layout "battle"/"planar")
horizontal INTEGER NOT NULL DEFAULT 0, -- boolean: printed/displayed sideways (Scryfall layout "battle"/"planar")
-- Representative printing's images, captured from the Oracle Cards bulk
-- (Scryfall's own pick of "the most up-to-date recognizable" English
-- printing) — preferred over `printings` for display so previews don't
-- show an arbitrary promo/showcase/foreign-language printing. Empty when
-- absent (falls back to `printings`).
image_uri TEXT NOT NULL DEFAULT '',
back_image_uri TEXT NOT NULL DEFAULT '',
default_scryfall_id TEXT NOT NULL DEFAULT ''
);
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);