We store each individual edit made by the user as a row in the Contributions table. If the user makes multiple changes before they click save, we will internally process it as a series of individual commits to the database.
For example, if the user does the following:
- Remove 1 existing depicts item
- Add 2 new depicts items
- Click save
Then we would actually add 3 new entries to the database (one for each individual statement added/removed)
Data structure
These are the columns to use, along with some example data
id | user_id | campaign_id | file | edit_type | edit_action | edit_content |
1 | 7 | 3 | File:Blackcat-Lilith.jpg | "depicts" | "add" | "Q123" |
2 | 2 | 3 | File:Blackcat-Lilith.jpg | "depicts" | "remove" | "Q123" |
2 | 7 | 3 | File:Blackcat-Lilith.jpg | "caption" | "add" | "en: A black cat" |
2 | 7 | 3 | File:Blackcat-Lilith.jpg | "caption" | "edit" | "fr: Un chat noir" |
user_id and campaign_id
Both foreign keys pointing to their respective tables.
file
Common's filename which has been edited
edit_type
"depicts" or "caption".
edit_action
"add", "remove", or "edit"
Note: "edit" only applicable for caption edits
edit_content
String which is either a Q number (for depicts - e.g. "Q84"), or language prefixed text (for captions - e.g. "en: some caption")