change setup script to run sql each update instead of initial setup only

This commit is contained in:
ksyasuda 2022-01-06 23:35:09 -08:00
parent b3f8aa48d3
commit b0cb5ddc66
2 changed files with 6 additions and 11 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
.git .git
.vscode .vscode
.projectile .projectile
.sql

View File

@ -43,17 +43,11 @@ run_setup() {
log "Directory created" log "Directory created"
fi fi
if [[ ! -f "$DIR/$DB" ]]; then log "CREATING/UPDATING HISTORY DATABASE TABLES"
log "Creating history database..." sqlite3 "$DIR/$DB" < sql/search_history_tbl.sql
sqlite3 "$DIR/$DB" < sql/watch_history_tbl.sql sqlite3 "$DIR/$DB" < sql/watch_history_tbl.sql
sqlite3 "$DIR/$DB" < sql/search_history_tbl.sql sqlite3 "$DIR/$DB" < sql/file_history.sql
sqlite3 "$DIR/$DB" < sql/file_history.sql log "FINISHED CREATING/UPDATING THE TABLES"
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
if [[ ! -d "$DIR/themes" ]]; then if [[ ! -d "$DIR/themes" ]]; then
log "themes directory does not exist in filesystem... Creating and moving themes" log "themes directory does not exist in filesystem... Creating and moving themes"