From 4d177912298307f789b47108932d87273bfb420e Mon Sep 17 00:00:00 2001 From: Michael Gamlem III Date: Mon, 25 Jul 2022 16:30:23 -0700 Subject: [PATCH] Use DELETE instead of DROP when modifying tables See: https://github.com/stevejenkins/pihole-cloudsync/issues/40#issuecomment-1194760079 --- pihole-cloudsync | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pihole-cloudsync b/pihole-cloudsync index d6c6209..7bfc6ce 100755 --- a/pihole-cloudsync +++ b/pihole-cloudsync @@ -92,10 +92,10 @@ pull_initialize () { $SUDO cp $cname_list $dnsmasq_dir # Overwrite local database tables - $SUDO sqlite3 $gravity_db "DROP TABLE adlist;" + $SUDO sqlite3 $gravity_db "DELETE FROM adlist;" $SUDO sqlite3 $gravity_db -header -csv ".import adlist.csv adlist" if [ -s domainlist.csv ]; then - $SUDO sqlite3 $gravity_db "DROP TABLE domainlist;" + $SUDO sqlite3 $gravity_db "DELETE FROM domainlist;" $SUDO sqlite3 $gravity_db -header -csv ".import domainlist.csv domainlist" fi @@ -155,10 +155,10 @@ pull () { $SUDO service pihole-FTL stop $SUDO cp $custom_list $pihole_dir $SUDO cp $cname_list $dnsmasq_dir - $SUDO sqlite3 $gravity_db "DROP TABLE adlist;" + $SUDO sqlite3 $gravity_db "DELETE FROM adlist;" $SUDO sqlite3 $gravity_db -header -csv ".import adlist.csv adlist" if [ -s domainlist.csv ]; then - $SUDO sqlite3 $gravity_db "DROP TABLE domainlist;" + $SUDO sqlite3 $gravity_db "DELETE FROM domainlist;" $SUDO sqlite3 $gravity_db -header -csv ".import domainlist.csv domainlist" fi $SUDO pihole -g