Database structure

This plugin works with two custom tables, all database related functions are in /DaReactions/Data.

The table structure is this:

TABLE %prefix%da_r_reactions

Name       |Type      |Length    |Key    |Default           |Extra
ID         |mediumint |9         |PRI    |                  |AUTO_INCREMENT
label      |varchar   |36        |       |"Reaction"        |
file_name  |varchar   |          |       |""                |
created_at |timestamp |          |       |CURRENT_TIMESTAMP |
color      |varchar   |36        |       |"#006699"         |
active     |smallint  |1         |       |1                 |
sort_order |smallint  |3         |       |0                 |

============================================================================

TABLE %prefix%da_r_votes

Name          |Type       |Length |Key    |Default           |Extra
ID            |mediumint  |9      |PRI    |                  |AUTO_INCREMENT
resource_id   |mediumint  |9      |MUL    |NULL              |
resource_type |varchar    |20     |MUL    |NULL              |
emotion_id    |mediumint  |9      |       |                  |
user_id       |varchar    |32     |MUL    |NULL              |
user_token    |varchar    |32     |       |NULL              |
user_ip       |varchar    |16     |       |NULL              |
created_at    |timestamp  |       |       |CURRENT_TIMESTAMP |

============================================================================

The choice to use own tables for this plugin is functional to some features:

  • The queries to pick most voted reactions, most liked posts and things like those are more simple and less time-consuming for the database.
  • In multisite installations every blog has its own tables that are independent from other blogs.
  • When delete all plugin data, on deactivate or uninstall, those table are dropped and there is no garbage left in database.