LartTyler / MHWDB-API

Source code for the Monster Hunter World API project
GNU Affero General Public License v3.0
74 stars 11 forks source link

Merge release/1.17.0 into master #127

Closed LartTyler closed 4 years ago

LartTyler commented 4 years ago

Post-Release Commands

./bin/console --env=prod app:tools:extract-elderseal-attributes --delete-attribute
./bin/console --env=prod app:tools:extract-phial-attributes --delete-attribute
./bin/console --env=prod app:tools:extract-ammo-capacities-attributes --delete-attribute
./bin/console --env=prod app:tools:extract-bow-coating-attributes --delete-attribute
./bin/console --env=prod app:tools:extract-special-ammo-attributes --delete-attribute
./bin/console --env=prod app:tools:extract-deviation-attributes --delete-attribute
./bin/console --env=prod app:tools:extract-boost-type-attributes --delete-attribute
./bin/console --env=prod app:tools:extract-shelling-type-attributes --delete-attribute
./bin/console --env=prod app:tools:extract-damage-type-attributes --delete-attribute

Changelog

Breaking Changes

Deprecations


New $size Operator

Early on the API's lifetime, the decision was made to support queries against the length of a collection or relationship via a special .length field. To do this, an extra column was added for every relationship that stored a cached count of the number of elements in the relationship. When a query hit the API that used the length field, it would be translated to the correct column name (e.g. crafting.materials.length would actually query crafting.materialsLength). This worked well when the API was read-only, and lengths could be calculated on a development server, then pushed to production. Now that the API relies on user contributed information, however, those cached lengths have to be recalculated every time an entity with relationships is updated, even if the number of items in the relationship hasn't changed.

With the most recent update to the dbstudios/doctrine-query-document library, it became possible to leverage Doctrine's built-in SIZE function for relationships, like so.

/skills?q={"ranks": {"$size": 1}}

In the example above, the API would return any skill with exactly one rank. The $size operator also supports embedding other operators, to give you more flexibility in your queries.

/skills?q={"ranks": {"$size": {"$lte": 1}}}
/skills?q={"ranks": {"$size": {"$in": [1, 2, 3]}}

The examples above would return skills with zero or one rank, and skills with one, two, or three ranks, respectively. For more information on the $size query, refer to the library docs.