Skip to content

Commit

Permalink
Merge pull request #63 from bcgov/fix-historic-removal
Browse files Browse the repository at this point in the history
put historic db in subfolder, only remove db file. Fixes #62
  • Loading branch information
ateucher authored Apr 14, 2021
2 parents 9fce384 + c652746 commit de8939c
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 de8939c

Please sign in to comment.