When the user clicks **save** in eitherWe store each individual edit made by the depicts or captions secuser as a row in the Contributions, table. we need to store a contribution inIf the user makes multiple changes before the database.y click save, The 'save' functions will later have the API calls added to actually make the Commons edits on behalf of the user.
Contributions table structure:we will internally process it as a series of individual commits to the database.
| id | user_id | campaign_id | file | edit_type | edit_content |For example, if the user does the following:
== user_id and campaign_id ==* Remove 1 existing depicts item
Both foreign keys pointing to their respective tables.
== file ==* Add 2 new depicts items
Common's filename which has been edited
== edit_type ==* Click save
either "depicts" or "caption".Then we would actually add **3 new** entries to the database (one for each individual statement added/removed)
== edit_content ==== Data structure ==
We should store the edit_content as a JSON string.These are the columns to use, along with some example data
**Depicts example**:| id | user_id | campaign_id | file | edit_type | edit_action | edit_content |
```| 1 | 7 | 3 | File:Blackcat-Lilith.jpg | "depicts" | "add" | "Q123" |
[
{ "value": "Q123", "action": "add"},
{ "value": "Q84", "action": "remove"},| 2 | 2 | 3 | File:Blackcat-Lilith.jpg | "depicts" |"remove" | "Q123" |
{ "value": "Q84", "ac| 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 ==
**Caption example**:Both foreign keys pointing to their respective tables.
== file ==
Captions can be either added or edited (I can't see any reason why we need to support removing captions. If it's bad or incorrect it can be edited)ommon's filename which has been edited
== edit_type ==
```"depicts" or "caption".
== edit_action ==
[
{ "lang": "en", text: "Man playing the flute", "action": "add"},
{ "lang": "fr", text: "Homme jouant de la flûte", "remove", "action":or "edit"},
{ "lang": "de", text: "Man spielt Flöte", "action": "add"},
]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")