Bene added a comment. In https://phabricator.wikimedia.org/T72229#1143170, @Bene wrote:
> 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. The wording in this statement is not correct. Of course option 1 can work but we will face some anomalies <https://de.wikipedia.org/wiki/Anomalie_%28Informatik%29> (I only found the German Wikipedia article on that topic) because we'd have to extend the unique key of site_id and page to site_id, page and badge_id. This has to be handled carefully for insert and delete operations. However, this solution is way more efficient than option 2 because it avoids joins between the two tables. Furthermore, as we only have a very small percentage of good or featured articles the redundancy caused by this solution is negligible. To sum up, both options are arguable. Option 1 is more efficient but sensitive in terms of insert/delete operations. Option 2 requires joins but is free of anomalies. 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: Liuxinyu970226, Wikidata-bugs, Bene, aude, Superyetkin, Ricordisamoa, Lydia_Pintscher, Stryn, daniel _______________________________________________ Wikidata-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs
