FROM reaction_log ORDER BY channel, ts, userid, reaction, event_ts DESC ) t1
WHERE event_type = 'reaction_added';
-CREATE TABLE reactions (
- userid VARCHAR NOT NULL,
- channel VARCHAR NOT NULL,
- ts VARCHAR NOT NULL,
- reaction VARCHAR NOT NULL,
- PRIMARY KEY (userid, channel, ts, reaction)
-);
-
GRANT SELECT,INSERT,DELETE ON TABLE applied TO skvidarlang;
GRANT SELECT,INSERT ON TABLE reaction_log TO skvidarlang;
GRANT SELECT ON TABLE current_reactions TO skvidarlang;
-GRANT SELECT,INSERT,DELETE ON TABLE reactions TO skvidarlang;
}
if ($type eq 'reaction_added') {
- $dbh->do('INSERT INTO reactions (userid, channel, ts, reaction) VALUES (?,?,?,?)', undef,
- $user, $channel, $ts, $reaction);
$dbh->do('INSERT INTO reaction_log (userid, channel, ts, reaction, event_type, event_ts) VALUES (?,?,?,?,?,?)', undef,
$user, $channel, $ts, $reaction, $type, $event_ts);
mark();
} elsif ($type eq 'reaction_removed') {
- $dbh->do('DELETE FROM reactions WHERE userid=? AND channel=? AND ts=? AND reaction=?', undef,
- $user, $channel, $ts, $reaction);
$dbh->do('INSERT INTO reaction_log (userid, channel, ts, reaction, event_type, event_ts) VALUES (?,?,?,?,?,?)', undef,
$user, $channel, $ts, $reaction, $type, $event_ts);
mark();