Skip to contents

This function sets up a new SQLite database or upgrades it if it already exists. The function will:

  1. Check the current version of the database.

  2. Create a new one if none exists or upgrades an existing database to the target version.

  3. Handle errors during the setup or upgrade process and revert any changes.

Usage

setup_database(expected_database_version, pkgname, database)

Arguments

expected_database_version

A string that contains the expected database version for the application release.

pkgname

Name of the R package.

database

Path to the SQLite database file.

Value

NULL (The function is primarily called for its side effects).

Examples

if (FALSE) { # \dontrun{
  setup_database(list(database = "2.0.0"))
} # }