]> git.sesse.net Git - skvidarsync/commitdiff
Handle edits, at last?
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 8 Dec 2023 13:08:44 +0000 (14:08 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 8 Dec 2023 13:08:44 +0000 (14:08 +0100)
bin/ws.pl

index c6746a84e3a6167241ff385eaaf42edd40523fc9..583ab38cd6e3802dd5146c029d7161f9db9479d2 100644 (file)
--- a/bin/ws.pl
+++ b/bin/ws.pl
@@ -123,7 +123,7 @@ sub handle_event {
                        my $channel = $ev->{'channel'};
                        my $ts = $ev->{'message'}{'ts'};
                        print STDERR "Matching message {$channel, $ts} to date $date\n";
-                       $dbh->do('INSERT INTO message_sheet_link (channel, ts, sheet_title) VALUES (?,?,?)', undef,
+                       $dbh->do('INSERT INTO message_sheet_link (channel, ts, sheet_title) VALUES (?,?,?) ON CONFLICT (channel,ts) DO UPDATE SET sheet_title=EXCLUDED.sheet_title', undef,
                                $channel, $ts, $date);
                        # Blow the cache.
                        $dbh->do('UPDATE message_sheet_link SET tab_name=NULL, tab_id=NULL WHERE channel=?', undef, $channel);