prepare_example_db: Prepare example db

View source: R/helper_testing.R

prepare_example_dbR Documentation

Prepare example db

Description

Create a SQLite database for testing called test.sqlite in specified directory. This bootstraps a simple table called people with data optionally added. This should only be called from a test, vignette or roxygen example.

Usage

prepare_example_db(
  dir,
  add_data = FALSE,
  add_job_table = FALSE,
  add_log_table = TRUE,
  add_fk_data = FALSE,
  add_cyclic_fks = FALSE
)

Arguments

dir

Directory to create the db in

add_data

If TRUE data is bootstrapped to people table

add_job_table

If TRUE also bootstrap job table related to people table

add_log_table

If TRUE also bootstrap log table using sql in inst dir

Details

Create a simple "people" table in the DB for testing the import process. Ideally this would be in a helper-*.R file in testthat directory but we need to be able to setup a DB for vignette. Expect the calling function to cleanup the created db if it is not in a tempdir.


vimc/dettl documentation built on Oct. 6, 2022, 2:13 p.m.