From b0cb5ddc66e7b6f54a22539be2480bf666216ffe Mon Sep 17 00:00:00 2001 From: ksyasuda Date: Thu, 6 Jan 2022 23:35:09 -0800 Subject: [PATCH] change setup script to run sql each update instead of initial setup only --- .gitignore | 1 + setup.sh | 16 +++++----------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 6affb3a..3edd018 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ .git .vscode .projectile +.sql diff --git a/setup.sh b/setup.sh index d0f7814..bba298c 100755 --- a/setup.sh +++ b/setup.sh @@ -43,17 +43,11 @@ run_setup() { log "Directory created" fi - if [[ ! -f "$DIR/$DB" ]]; then - log "Creating history database..." - sqlite3 "$DIR/$DB" < sql/watch_history_tbl.sql - sqlite3 "$DIR/$DB" < sql/search_history_tbl.sql - sqlite3 "$DIR/$DB" < sql/file_history.sql - log "History database created..." - elif ! sqlite3 -noheader -batch "$DIR/$DB" ".tables" | grep -q 'file_history'; then - log "file_history table not found in database... creating table" - sqlite3 "$DIR/$DB" < sql/file_history.sql - log "file_history table created" - fi + log "CREATING/UPDATING HISTORY DATABASE TABLES" + sqlite3 "$DIR/$DB" < sql/search_history_tbl.sql + sqlite3 "$DIR/$DB" < sql/watch_history_tbl.sql + sqlite3 "$DIR/$DB" < sql/file_history.sql + log "FINISHED CREATING/UPDATING THE TABLES" if [[ ! -d "$DIR/themes" ]]; then log "themes directory does not exist in filesystem... Creating and moving themes"