Skip to content

Commit

Permalink
Use DELETE instead of DROP when modifying tables
Browse files Browse the repository at this point in the history
  • Loading branch information
mgamlem3 committed Jul 25, 2022
1 parent 25dd8f5 commit 4d17791
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pihole-cloudsync
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4d17791

Please sign in to comment.