From: Jacob Casper Date: Sun, 5 Apr 2020 09:21:27 +0000 (-0500) Subject: Enable foreign keys on sent media insert X-Git-Url: https://git.jacobcasper.com/?a=commitdiff_plain;h=a1e559df7df7628ed8e6574d49144533d9faa791;p=mercuryms.git Enable foreign keys on sent media insert --- diff --git a/send.sh b/send.sh index e38559c..b2e0e73 100755 --- a/send.sh +++ b/send.sh @@ -1,2 +1,2 @@ #!/bin/bash -sqlite3 mercuryms.sqlite "$(awk '/received/ {print "INSERT INTO SENT_MEDIA (MEDIA_ID) VALUES("$1");";}' <(sqlite3 mercuryms.sqlite "SELECT ID, PHONE_NUMBER, URI FROM MEDIA WHERE ID NOT IN (SELECT MEDIA_ID FROM SENT_MEDIA)" | timeout $TIMEOUT_SECONDS netcat $HOST $PORT))" +sqlite3 mercuryms.sqlite "$(awk 'BEGIN {print "PRAGMA FOREIGN_KEYS = ON;"} /received/ {print "INSERT INTO SENT_MEDIA (MEDIA_ID) VALUES("$1");";}' <(sqlite3 mercuryms.sqlite "SELECT ID, PHONE_NUMBER, URI FROM MEDIA WHERE ID NOT IN (SELECT MEDIA_ID FROM SENT_MEDIA)" | timeout $TIMEOUT_SECONDS netcat $HOST $PORT))"