lunakv / academyruins-api

Rules API for Magic: The Gathering
https://api.academyruins.com/docs
GNU Affero General Public License v3.0
4 stars 1 forks source link

Normalize CR diff schema #61

Closed lunakv closed 1 year ago

lunakv commented 1 year ago

Instead of storing the entire diff contents in a JSONB blob (and an array for moves), this PR introduces a new table to the database that stores individual diff/move items. Apart from easier querying and general management of the data, one notable improvement is the evaluation of CR traces, which can now search through the indexed number columns of the new table instead of linearly scanning through all previous diffs. The trace functionality itself has been mostly replaced from a pure Python implementation into a single recursive Postgres query.