Run this once, when setting up a new EpiSODIC instance: it creates a new
database at path and builds all the required tables. Refuses to run
against a database that already has tables in it, so it cannot
accidentally overwrite existing surveillance data - use
episodic_db_connect() to open a database you have already set up.
Arguments
- path
Path to a SQLite file to create, or a
mysql://DSN (seeepisodic_db_dsn_mariadb()) pointing at a MariaDB/MySQL database. The schema does not have to be empty: EpiSODIC only ever enumerates and touches its own tables, so it can share one with another application. It does have to be free of EpiSODIC's tables, unlessoverwrite = TRUE.- overwrite
If
TRUE, delete an existing SQLite file (or drop all tables in an existing MariaDB/MySQL database) first. Use with care - this destroys any data already there.
Value
(Invisibly) an open DBI::DBIConnection to the new
database. You are responsible for disconnecting it (with
DBI::dbDisconnect()) when done.
Examples
db_path <- tempfile(fileext = ".sqlite")
con <- episodic_db_create(db_path)
DBI::dbDisconnect(con)
file.remove(db_path)
#> [1] TRUE