From 1fd05038c0edc1f14e60545336bedffff6710bf5 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Fri, 27 Oct 2023 15:11:03 +0200 Subject: [PATCH] Remove the legacy (non-logged) reactions table. --- skvidarlang.sql | 9 --------- www/event.pl | 4 ---- 2 files changed, 13 deletions(-) diff --git a/skvidarlang.sql b/skvidarlang.sql index 78e39e8..ae0fb8d 100644 --- a/skvidarlang.sql +++ b/skvidarlang.sql @@ -22,16 +22,7 @@ CREATE VIEW current_reactions AS 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; diff --git a/www/event.pl b/www/event.pl index cf7a212..9743520 100755 --- a/www/event.pl +++ b/www/event.pl @@ -52,14 +52,10 @@ if (exists($json->{'event'}) && exists($json->{'event'}{'type'})) { } 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(); -- 2.39.2