1
0
Fork 0
mirror of https://github.com/Lynnesbian/FediBooks/ synced 2024-11-25 08:38:59 +00:00

insert ignore instead of replace to avoid cascade deletion from the bot learning list fricking WHOOPS

This commit is contained in:
Lynne Megido 2020-04-11 17:20:58 +10:00
parent 8469b73c3c
commit d5db51830b
Signed by: lynnesbian
GPG key ID: F0A184B5213D9F90

View file

@ -129,7 +129,7 @@ def bot_accounts_add(mysql, cfg):
if r.status_code == 200:
# success!!
c = mysql.connection.cursor()
c.execute("REPLACE INTO `fedi_accounts` (`handle`, `outbox`) VALUES (%s, %s)", (session['handle'], outbox))
c.execute("INSERT IGNORE INTO `fedi_accounts` (`handle`, `outbox`) VALUES (%s, %s)", (session['handle'], outbox))
c.execute("INSERT INTO `bot_learned_accounts` (`bot_id`, `fedi_id`) VALUES (%s, %s)", (session['bot'], session['handle']))
c.close()
mysql.connection.commit()