Skip to contents

Inserts a new row into the facilities_attributes_bridge_table, where changes to the various facilities tables are recorded.

Usage

insert_change_log(
  facility_attribute_id,
  facility_type,
  facility_id,
  attribute,
  value,
  valid_from = NA,
  valid_to = NA,
  notes = NULL,
  test_db = FALSE
)

Arguments

facility_attribute_id

The value of the facility_attribute_id for the facility whose change you're recording.

facility_type

Is the facility an asset, a space, or an entity?

facility_id

The value of the facility_id field for the facility whose change you're recording

attribute

The attribute, or field name, that is affected by the change.

value

The new value that is being supplied for this facility.

valid_from

From when did this change take effect?

valid_to

Until when is this change valid?

notes

Explanatory notes for the change, such as the justification for the change, the meaning of the change, and/or the person who authorised this change.

test_db

Is this change being applied to a facility in the test database (TRUE) or not (FALSE)? Defaults to FALSE.

Value

A tibble with 1 row and 9 columns showing the log entry you supplied as recorded in the database.

Examples

change <- insert_change_log(
facility_attribute_id = "FA601",
facility_type = "Space",
facility_id = "S374",
attribute = "bookable",
value = "Y",
valid_from = Sys.Date(),
notes = "This room can now be booked by members of the public.",
test_db = TRUE
)

change
#>   id facility_attribute_id facility_type facility_id attribute value valid_from
#> 1  2                 FA601         Space        S374  bookable     Y 2024-05-31
#>   valid_to                                                 notes
#> 1     <NA> This room can now be booked by members of the public.