Skip to content

Commit

Permalink
put historic db in subfolder, only remove db file. Fixes #62
Browse files Browse the repository at this point in the history
  • Loading branch information
ateucher committed Apr 13, 2021
1 parent 9fce384 commit c652746
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions R/ems_sqlite.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ download_historic_data <- function(force = FALSE, ask = TRUE, dont_update = FALS
on.exit(unlink(csv_file), add = TRUE)

if (db_exists) {
unlink(dirname(db_path), recursive = TRUE)
file.remove(db_path)
write_db_path()
}

Expand Down Expand Up @@ -277,7 +277,9 @@ stringify_vec <- function(vec) {

write_db_path <- function(path = getOption("rems.historic.path",
default = rems_data_dir())) {
file.path(path, "ems_historic.sqlite")
db_path <- file.path(path, "historic_db", "ems_historic.sqlite")
dir.create(dirname(db_path), recursive = TRUE, showWarnings = FALSE)
db_path
}

#' Add an index to a column in a sqlite database
Expand Down

0 comments on commit c652746

Please sign in to comment.