Files
sorsfonalak/crates/db/migrations/0031_tarot.sql
T
fecoandClaude Opus 5.5 b0fc547b73
CI / test (push) Successful in 1m29s
CI / build (push) Successful in 5m52s
CI / deploy (push) Skipped
Tarot readings: AI-written, drawn on the server, sold as units
A new Kártyajóslás page: choose a spread (1, 3 or 5 cards), ask a
question, pick the cards from the fanned deck and watch them turn over;
the reading is written by the detailed-analysis model from the cards,
their positions and base meanings, the question and the reader's Sun,
Moon and Ascendant. The server shuffles and draws, so nobody can draw
again for free. A reading is a 'tarot' analysis (worker, retries,
fallback, refunds and admin regeneration as for analyses), uses one
'tarot' unit, and survives recalculations; deleting the account
deletes it.

Packages carry 2/5/10 readings, the new +5 kártyajóslás addon costs
1 000 Ft. The card artwork comes from the tarot design studio
(celestial astrolabe style); the deck JSON is shared by the frontend
and the prompt. A public example is at /kartyajoslas/pelda.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-20 14:35:50 +00:00

22 lines
1.4 KiB
SQL

-- Tarot readings: a `tarot` analysis (stored with the other analyses, so
-- the worker, retries, fallback and refunds work the same) holds the spread,
-- the question, the cards drawn by the server and the reader's Sun, Moon and
-- Ascendant in `tarot`. Each reading uses one `tarot` unit.
ALTER TABLE analyses DROP CONSTRAINT analyses_kind_check;
ALTER TABLE analyses ADD CONSTRAINT analyses_kind_check
CHECK (kind IN ('natal', 'synastry', 'summary', 'forecast', 'tarot'));
ALTER TABLE analyses ADD COLUMN tarot jsonb;
ALTER TABLE analyses DROP CONSTRAINT analyses_target;
ALTER TABLE analyses ADD CONSTRAINT analyses_target CHECK (
(kind IN ('natal', 'summary') AND chart_id IS NOT NULL AND synastry_id IS NULL AND forecast_id IS NULL)
OR (kind = 'synastry' AND synastry_id IS NOT NULL AND chart_id IS NULL AND forecast_id IS NULL)
OR (kind = 'forecast' AND forecast_id IS NOT NULL AND chart_id IS NULL AND synastry_id IS NULL)
OR (kind = 'tarot' AND tarot IS NOT NULL AND chart_id IS NULL AND synastry_id IS NULL AND forecast_id IS NULL)
);
ALTER TABLE credit_ledger DROP CONSTRAINT credit_ledger_unit_check;
ALTER TABLE credit_ledger ADD CONSTRAINT credit_ledger_unit_check
CHECK (unit IN ('natal', 'synastry', 'forecast', 'person', 'question', 'tarot'));
CREATE INDEX analyses_tarot_idx ON analyses (requested_by, created_at DESC) WHERE kind = 'tarot';