Article feedback/Version 5/Technical Design Schema

This page describes the database schema for the Article Feedback Tool Version 5 (AFT V5). For more information, check the feature requirements and the final project report.

Overview edit

There is only 1 table for AFTv5 data: aft_feedback. It can live on the same database as the rest of the MediaWiki setup's code, or it can be in a totally different database.

As a result of $wgArticleFeedbackv5Cluster being false by default, the standard scenario for AFTv5 will have the table live on the same database. To have AFTv5 live on a separate database, change the value for $wgArticleFeedbackv5Cluster to the external server's value. Assuming you have an external database at $wgExternalServers['extension1'] = array( /* ... */ );, you'd set $wgArticleFeedbackv5Cluster = 'extension1';

When a feedback post is submitted, a record is created in aft_feedback.

All moderation actions performed on a feedback entry will result in an entry being written to the core MediaWiki logging table. Because it would be expensive to join aft_feedback and logging (and even impossible if the AFTv5 table lives on a different database) to query for the status of feedback, those statuses are de-normalized and are also represented in aft_feedback (like aft_resolve, aft_inappropriate, ...)

aft_feedback edit

 
AFTv5 schema
Column Type Data
aft_id binary(32) Primary key. A unique ID per feedback entry. Part of them are auto-incremented IDs, part of them base 16 128-bit UIDs (as generated by UIDGenerator::newTimestampedUID128( 16 )).
aft_page integer The ID of the page the feedback was given for, cfr. page.page_id
aft_page_revision integer The ID of the page revision the feedback was given for, cfr. revision.rev_id
aft_user integer The ID of the user who entered the feedback, cfr. user.user_id. Or 0 for anonymous users.
aft_user_text varchar(255) The username of the user who entered the feedback, at the time the feedback was submitted, cfr. user.user_name. Or the IP address of anonymous users.
aft_user_token varbinary(32) Unique user identifier, as returned by JavaScript mw.user.id() (will return the username, or a randomly generated session ID)
aft_form binary(1) The ID of the form that is displayed before submitting feedback. One of the buckets in $wgArticleFeedbackv5DisplayBuckets. Form descriptions at Article feedback/Version 5/Feature Requirements#Feedback forms
aft_cta binary(1) The ID of the CTA that is displayed after submitting feedback. One of the buckets in $wgArticleFeedbackv5CTABuckets. CTA descriptions at Article feedback/Version 5/Feature Requirements#Calls to Action (CTAs)
aft_link binary(1) The ID of the link that is displayed before submitting feedback. One of the buckets in $wgArticleFeedbackv5LinkBuckets. Link descriptions at Article feedback/Version 5/Feature Requirements#Feedback links
aft_rating tinyint(1) A 1/0 value reflecting the response to initial "Did you find what you were looking for?" question. 0 being "No", 1 being "Yes".
aft_comment mediumblob The comment entered in the free-form textarea.
aft_timestamp varbinary(14) The timestamp the feedback was submitted, in TS_MW format (YYYYMMDDHHMMSS)
aft_oversight tinyint(1) 1 if the feedback's status is oversighted, or 0 otherwise.
aft_decline tinyint(1) 1 if the feedback's status is oversight declined, or 0 otherwise.
aft_request tinyint(1) 1 if the feedback's status is oversight requested, or 0 otherwise.
aft_hide tinyint(1) 1 if the feedback's status is hidden, or 0 otherwise.
aft_autohide tinyint(1) 1 if the feedback's status is autohidden, or 0 otherwise. If this is 1, aft_hide will always be 1 too.
aft_flag integer The number of times the feedback has been marked as abusive.
aft_autoflag tinyint(1) 1 if the feedback has been automatically marked as abusive.
aft_feature tinyint(1) 1 if the feedback's status is useful, or 0 otherwise.
aft_resolve tinyint(1) 1 if the feedback's status is resolved, or 0 otherwise.
aft_noaction tinyint(1) 1 if the feedback's status is non-actionable, or 0 otherwise.
aft_inappropriate tinyint(1) 1 if the feedback's status is marked as inappropriate, or 0 otherwise.
aft_archive tinyint(1) 1 if the feedback's status is archived, or 0 otherwise.
aft_archive_date varbinary(14) The timestamp the article can be marked as archived, in TS_MW format (YYYYMMDDHHMMSS). Archive date will be recalculated after every action taken on the feedback (based on based on $wgArticleFeedbackv5AutoArchiveTtl). After this date has passed, the feedback can effectively be hidden (by running maintenance/archiveFeedback.php): aft_archive is then set to 1.
aft_helpful integer The number of times the feedback has been marked as helpful.
aft_unhelpful integer The number of times the feedback has been marked as unhelpful.
aft_has_comment tinyint(1) 1 if the submitted feedback has a textual comment, 0 if comment is empty.
aft_net_helpful integer The helpfulness score: aft_helpful - aft_unhelpful.
aft_relevance_score integer The relevance score, as calculated by $wgArticleFeedbackv5RelevanceScoring. See extension.json for detailed list of scores per action.
aft_claimed_user integer The ID of the user who "claimed" the feedback. This will usually just be equivalent to aft_user, with the sole exception being feedback submitted by an anonymous user, followed by that user immediately logging in. In that case, the ID of that user will be saved in this column.
aft_discuss enum('user', 'talk') Depending on the exact status of the feedback, it can be discussed on either the article's talk page, or the submitting user's page. If a discussion has been started on talk page, this will hold the value 'talk', or 'user' if discussion has been started on the user's page.

logging edit

Parts of the documentation here (especially related to user IDs/names) are likely outdated due to actor migration; see commit 51a2eea020f2e424a8e0ea055a7c412e5980f818.
Column Type What it does
log_id int(10) Auto-increment
log_type varbinary(32) Either 'articlefeedbackv5' or 'suppress', depending on whether or not we want the action to show up in central activity log/visible to all users
log_action varbinary(32) The action being performed, e.g. 'feature', 'flag', ... (full list: keys of ArticleFeedbackv5Activity::$actions)
log_timestamp varbinary(14) Self-explanatory, timestamp of the moment the action is logged - handled by core ManualLogEntry
log_user int(10) ID of the user whose action is being logged (for automated actions, a special user 'articlefeedbackv5-default-user' is created) - handled by ArticleFeedbackv5Activity::log based upon the User object tossed in
log_user_text int(11) Name of the user whose action is being logged (for automated actions, a special user 'articlefeedbackv5-default-user' is created) - handled by ArticleFeedbackv5Activity::log based upon the User object tossed in
log_namespace varbinary(255) The article namespace of the feedback permalink - handled by ArticleFeedbackv5Activity::log based upon the Title object tossed in
log_title varbinary(255) The article title of the feedback permalink - handled by ArticleFeedbackv5Activity::log based upon the Title object tossed in
log_page blob The article ID of the feedback permalink - handled by ArticleFeedbackv5Activity::log based upon the Title object tossed in
log_comment tinyint(3) A (truncated to 255 characters) note attached to the action (when using fly-over panels that allow for notes, e.g. 'oversight')
log_params varbinary(255) Will add feedbackId & pageId parameters, as well as anything tossed into ArticleFeedbackv5Activity::log's $params argument
log_deleted int(10) Unused by AFTv5 - handled by core LogPage