Nothing
# Store the current options (for later conservation test -- see test-zzz.R)
diseasy_opts <- purrr::keep(names(options()), ~ startsWith(., "diseasystore.")) |>
purrr::map(options) |>
purrr::reduce(c)
# Store the current files (for later conservation test -- see test-zzz.R)
current_files <- dir(recursive = TRUE)
# Configure diseasystore for testing
target_schema_1 <- "test_ds"
target_schema_2 <- "not_test_ds"
# Ensure the target conns are empty and configured correctly
for (conn in get_test_conns()) {
# Try to write to the target schema
test_id <- SCDB::id(paste(target_schema_1, "mtcars", sep = "."), conn)
# Delete existing
if (DBI::dbExistsTable(conn, test_id)) {
DBI::dbRemoveTable(conn, test_id)
}
# Check write permissions
DBI::dbWriteTable(conn, test_id, mtcars)
if (!DBI::dbExistsTable(conn, test_id)) {
rlang::abort("Cannot write to test schema (", target_schema_1, "). Check DB permissions.")
}
# Delete the existing data in the schema
drop_diseasystore(schema = target_schema_1, conn = conn)
drop_diseasystore(schema = target_schema_2, conn = conn)
# Check test schemas are empty
n_tables_in_test_schemas <- SCDB::get_tables(conn) |>
dplyr::pull("schema") |>
purrr::keep(~ . %in% c(target_schema_1, target_schema_2)) |>
length()
checkmate::assert_true(n_tables_in_test_schemas == 0)
# Disconnect
DBI::dbDisconnect(conn, shutdown = TRUE)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.