I don't know why the update isn't updating in the db.

pull/2/head
Hailey Clark 6 years ago
parent 55ddd48ad6
commit c55d894b21
  1. 4
      appdb.py
  2. 4
      database.md
  3. 15
      thewords.faith.txt

@ -42,7 +42,7 @@ def getNumSMSLog(did,limit=5):
#This gets the last X amount of logs from all numbers.
db = pymysql.connect(host=sqlhost, user=sqluser, passwd=sqlpass, db=sqldb)
cur = db.cursor()
cur.execute("SELECT * FROM messages WHERE source_number=%s OR dest_number=%s ORDER BY timestamp DESC LIMIT %s;",(did,did,limit))
cur.execute("SELECT * FROM messages WHERE source_number=%s OR dest_number=%s ORDER BY timestamp DESC LIMIT %s",(did,did,limit))
rows = cur.fetchall()
#for row in rows:
#pprint.pprint(row)
@ -54,7 +54,7 @@ def updateMsgStatus(msg_id,status):
#UPDATE messages SET delivered='success' WHERE pid='mdr2-46999f9ce19e11e99074722a1f1f4bb4'
db = pymysql.connect(host=sqlhost, user=sqluser, passwd=sqlpass, db=sqldb)
cur = db.cursor()
affected_count = cur.execute("UPDATE messages SET `delivered`=%s WHERE `pid`=%s;",(status,msg_id))
affected_count = cur.execute("UPDATE messages SET status=%s WHERE `pid`=%s",(status,msg_id))
pprint.pprint("updated : " + str(affected_count) + " set "+ status +" to " +msg_id)
db.close()
return True

@ -59,5 +59,5 @@ CREATE TABLE `messages` (
COLLATE='utf8_bin'
ENGINE=InnoDB
;
########## Update V1, add delivered enum to messages table.
ALTER TABLE messages ADD COLUMN delivered VARCHAR(30) NOT NULL DEFAULT 'pending';
########## Update V1, add delivered status to messages table.
ALTER TABLE messages ADD COLUMN status VARCHAR(30) NOT NULL DEFAULT 'pending';

@ -0,0 +1,15 @@
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/thewords.faith/html;
index index.html index.htm index.nginx-debian.html;
server_name thewords.faith;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Loading…
Cancel
Save