Skip to contents

update_enum_value() rename existing value

Usage

update_enum_value(
  con,
  enum = c("bin_code_enum", "survey_type_enum", "life_stage_enum", "origin_enum",
    "run_mode_enum", "optics_enum", "light_source_enum", "lamp_energy_enum",
    "well_location_enum"),
  existing_enum_value,
  new_enum_value
)

Arguments

con

A DBI connection object obtained from DBI::dbConnect()

enum

Provide one of the following:

  • "bin_code_enum" Used for generating sampling protocols and sample IDs

  • "survey_type_enum" Used for describing the survey types in permits

  • "life_stage_enum" Used for specifying chinook life stage in permits

  • "origin_enum" Used for specifying the chinook origin in permits

  • "run_mode_enum" Used for describing the run mode in the Synergy H1 protocol

  • "optics_enum" Used for describing the optics setting in the Synergy H1 protocol

  • "light_source_enum" Used for describing the light source in the Synergy H1 protocol

  • "lamp_energy_enum" Used for describing the lamp energy setting in the Synergy H1 protocol

  • "well_location_enum" Used for mapping the Synergy H1 result output to sample IDs well location in the assay results

existing_enum_value

existing value targeted to be renamed

new_enum_value

new name for existing value

See also

Other enum method functions: add_enum_value(), get_enum_values()

Examples

# example database connection
cfg <- config::get()
con <- DBI::dbConnect(RPostgres::Postgres(),
                      dbname = cfg$dbname,
                      host = cfg$host,
                      port = cfg$port,
                      user = cfg$username,
                      password = cfg$password)
#> Error: connection to server at "localhost" (::1), port 5432 failed: Connection refused (0x0000274D/10061)
#> 	Is the server running on that host and accepting TCP/IP connections?
#> connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused (0x0000274D/10061)
#> 	Is the server running on that host and accepting TCP/IP connections?

get_enum_values(con, "life_stage_enum")
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'dbObj' in selecting a method for function 'dbIsValid': object 'con' not found
update_enum_value(con, "life_stage_enum",
                  "Spawned Adult/Carcass", "Spawned Adult Carcass")
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'dbObj' in selecting a method for function 'dbIsValid': object 'con' not found