Bene added a comment.

In https://phabricator.wikimedia.org/T72229#1109613, @aude wrote:

> I don't think there is good solution to this other than have the badges in a 
> database table.
>
> We have two options:
>
> 1. schema change on the wb_items_per_site table to add a badge column (null 
> by default).
> 2. add a new table that can be joined to the ips_row_id column of 
> wb_items_per_site, containing ips_row_id + badge id
>
>   with option 1, in most cases, the value would be null and maybe we want to 
> go with option 2 to keep wb_items_per_site smaller, or maybe the impact isn't 
> too excessive and option 1 would be ok.


Option 1 will be a bit tricky because there may be several badges for one 
sitelink and thus one column could contain several badges (?) This obviously 
cannot work so perhaps we need option two.

In https://phabricator.wikimedia.org/T72229#739747, @daniel wrote:

> I'm not sure I agree that we need such a table (but I can be convinced).
>
> In any case, the basic structure should be:
>
>   ( badge, siteId, page )
>   
>
> with the primary key covering all three fields, in this order. This allows us 
> to efficiently find all pages that have a given badge, on all sites or a 
> given site.
>
> If we also want to be able to find all the badges associated with a given 
> page (on a given site), we'd need another index covering ( siteId, page ). 
> This would be useful if we wanted to show badges in listings of pages (e.g. 
> add icons for special pages in the Special:Allpages listing.
>
> For convenience, we may want to have a column for the associated item id. 
> This would remove the need to join against wb_item_per_site in cases where we 
> need to know the item ID. However, we generally don't care about the 
> associated item in this context, do we?


I'm not sure if it is better to include `ips_row_id` or `siteId, page` pairs. I 
rather tend to Daniel's suggestion because we will query for badges on a 
specific site which requires a `join` otherwise. Including the item id may also 
be helpful at some points.


TASK DETAIL
  https://phabricator.wikimedia.org/T72229

REPLY HANDLER ACTIONS
  Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign 
<username>.

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Bene
Cc: Wikidata-bugs, Bene, aude, Superyetkin, Ricordisamoa, Lydia_Pintscher, 
Stryn, daniel



_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to