Initial commit: MTG personal library catalog (Tauri v2 + React/TS)
Full working app with:
- Rust core (mtgc-core): Scryfall ingester, nucleo fuzzy search, SQLite two-DB
architecture (reference.db + library.db via ATTACH), criteria filters, deck ops
- Tauri v2 shell exposing the core as typed IPC commands
- React/TS frontend: card entry, library browser, deck editor
- Features: fuzzy card search, color/CMC/type/commander-identity filters,
tile/list view toggle, hover card previews, deck format + commander support,
per-card location field, grouping by type/subtype/CMC/color, localStorage
persistence for active tab/deck/grouping, Discord-inspired dark UI (#C8553D accent)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-07 19:37:56 -05:00
|
|
|
-- Schema for reference.db: read-only card data built from Scryfall bulk.
|
|
|
|
|
-- Applied against a connection whose `main` database IS the reference db
|
|
|
|
|
-- (the ingester opens reference.db directly; at runtime it is ATTACHed as `ref`).
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS oracle_cards (
|
|
|
|
|
oracle_id TEXT PRIMARY KEY,
|
|
|
|
|
name TEXT NOT NULL,
|
|
|
|
|
name_lower TEXT NOT NULL, -- for cheap case-insensitive substring
|
|
|
|
|
mana_value REAL NOT NULL DEFAULT 0,
|
|
|
|
|
colors INTEGER NOT NULL DEFAULT 0, -- WUBRG bitmask
|
|
|
|
|
color_identity INTEGER NOT NULL DEFAULT 0, -- WUBRG bitmask
|
|
|
|
|
type_line TEXT NOT NULL DEFAULT '',
|
|
|
|
|
oracle_text 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);
|
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_oracle_mv ON oracle_cards(mana_value);
|
|
|
|
|
|
|
|
|
|
-- Normalized attribute tables for fast type/subtype/keyword filtering.
|
|
|
|
|
CREATE TABLE IF NOT EXISTS card_types (
|
|
|
|
|
oracle_id TEXT NOT NULL,
|
|
|
|
|
type TEXT NOT NULL
|
|
|
|
|
);
|
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_card_types_type ON card_types(type);
|
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_card_types_oid ON card_types(oracle_id);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS card_subtypes (
|
|
|
|
|
oracle_id TEXT NOT NULL,
|
|
|
|
|
subtype TEXT NOT NULL
|
|
|
|
|
);
|
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_card_subtypes_sub ON card_subtypes(subtype);
|
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_card_subtypes_oid ON card_subtypes(oracle_id);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS card_keywords (
|
|
|
|
|
oracle_id TEXT NOT NULL,
|
|
|
|
|
keyword TEXT NOT NULL
|
|
|
|
|
);
|
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_card_keywords_kw ON card_keywords(keyword);
|
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_card_keywords_oid ON card_keywords(oracle_id);
|
|
|
|
|
|
|
|
|
|
-- One row per printing (default-language bulk).
|
|
|
|
|
CREATE TABLE IF NOT EXISTS printings (
|
|
|
|
|
scryfall_id TEXT PRIMARY KEY,
|
|
|
|
|
oracle_id TEXT NOT NULL,
|
|
|
|
|
set_code TEXT NOT NULL DEFAULT '',
|
|
|
|
|
collector_number TEXT NOT NULL DEFAULT '',
|
|
|
|
|
finishes TEXT NOT NULL DEFAULT '', -- comma-joined, e.g. "nonfoil,foil"
|
|
|
|
|
rarity TEXT NOT NULL DEFAULT '',
|
2026-07-07 20:54:55 -05:00
|
|
|
image_uri TEXT NOT NULL DEFAULT '',
|
|
|
|
|
back_image_uri TEXT NOT NULL DEFAULT '' -- transform/MDFC/reversible back face
|
Initial commit: MTG personal library catalog (Tauri v2 + React/TS)
Full working app with:
- Rust core (mtgc-core): Scryfall ingester, nucleo fuzzy search, SQLite two-DB
architecture (reference.db + library.db via ATTACH), criteria filters, deck ops
- Tauri v2 shell exposing the core as typed IPC commands
- React/TS frontend: card entry, library browser, deck editor
- Features: fuzzy card search, color/CMC/type/commander-identity filters,
tile/list view toggle, hover card previews, deck format + commander support,
per-card location field, grouping by type/subtype/CMC/color, localStorage
persistence for active tab/deck/grouping, Discord-inspired dark UI (#C8553D accent)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-07 19:37:56 -05:00
|
|
|
);
|
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_printings_oid ON printings(oracle_id);
|
|
|
|
|
|
|
|
|
|
-- Secondary trigram FTS index over names (typo-tolerant fallback; the primary
|
|
|
|
|
-- interactive search is the in-memory nucleo matcher).
|
|
|
|
|
CREATE VIRTUAL TABLE IF NOT EXISTS oracle_names_fts
|
|
|
|
|
USING fts5(name, oracle_id UNINDEXED, tokenize = 'trigram');
|