Article feedback/Version 5/Technical Design Schema
This page describes the database schema for the Article Feedback Tool Version 5 (AFT V5).
Overview[edit]
There is only 1 table for AFTv5 data: aft_feedback. It can live on the same database the rest of the MediaWiki setup's code is, 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 form 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]
| Column | Type | What it does |
|---|---|---|
aft_id |
binary(32) | Primary key. A unique ID per feedback entry. Generated via UIDGenerator::newTimestampedUID128( 16 ), so don't expect the values to be in insertion order (like auto-increment would do) |
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 identified, as returned by JavaScript mw.user.id() (will return the username, or a randomly generated session id) |
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_form |
binary(1) | The id of the form that is displayed before submitting feedback. One of the buckets in $wgArticleFeedbackv5DisplayBuckets. |
aft_cta |
binary(1) | The id of the CTA that is displayed after submitting feedback. One of the buckets in $wgArticleFeedbackv5CTABuckets. |
aft_link |
binary(1) | The id of the link that is displayed before submitting feedback. One of the buckets in $wgArticleFeedbackv5LinkBuckets. |
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_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. |
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 amount 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). Upon submitting feedback or performing an action on it, the archive date will be calculated based on $wgArticleFeedbackv5AutoArchiveTtl. When running maintenance/archiveFeedback.php (e.g. via cronjob), all feedback with aft_archive_date younger than the time the script is run, will have aft_archive set to 1 (= effectively marking feedback as archived) |
aft_helpful |
integer | The amount of times the feedback has been marked as helpful. |
aft_unhelpful |
integer | The amount 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. |
logging[edit]
| 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 ass anything tossed into ArticleFeedbackv5Activity::log's $params argument |
log_deleted |
int(10) | Unused by AFTv5 - handled by core LogPage |