From 212c238adccf1c4574e5c57c9b3ee03a82904b49 Mon Sep 17 00:00:00 2001 From: ClayBenson94 Date: Wed, 6 Sep 2023 13:33:59 -0400 Subject: [PATCH] chore: replace whitespace-edited files with versions from main to reduce PR changes --- .airDebug.conf | 2 +- .airDebugWait.conf | 2 +- docs/temporal_tables.md | 8 ++++---- scripts/dev | 1 - 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.airDebug.conf b/.airDebug.conf index 19a4a81e53..b8ed7744b9 100644 --- a/.airDebug.conf +++ b/.airDebug.conf @@ -11,7 +11,7 @@ cmd = "go build -o bin/mint ./cmd/mint" # Binary file yields from `cmd`. bin = "bin/mint" # Customize binary. -full_bin = "dlv debug --continue --accept-multiclient --headless --listen :2350 ./cmd/mint -- serve " +full_bin = "dlv debug --continue --accept-multiclient --headless --listen :2350 ./cmd/mint -- serve " # Watch these filename extensions. include_ext = ["go"] # Ignore these filename extensions or directories. diff --git a/.airDebugWait.conf b/.airDebugWait.conf index 87bc0aee13..892f2beb94 100644 --- a/.airDebugWait.conf +++ b/.airDebugWait.conf @@ -11,7 +11,7 @@ cmd = "go build -o bin/mint ./cmd/mint" # Binary file yields from `cmd`. bin = "bin/mint" # Customize binary. -full_bin = "dlv debug --accept-multiclient --headless --listen :2350 ./cmd/mint -- serve " +full_bin = "dlv debug --accept-multiclient --headless --listen :2350 ./cmd/mint -- serve " # Watch these filename extensions. include_ext = ["go"] # Ignore these filename extensions or directories. diff --git a/docs/temporal_tables.md b/docs/temporal_tables.md index 16b6797f4e..94a403f37a 100644 --- a/docs/temporal_tables.md +++ b/docs/temporal_tables.md @@ -11,7 +11,7 @@ This implementation works fairly well, but does have some features that could be It works by creating a history table that corresponds to every record that is desired to be audited. The versioning trigger is a called before the update of a row, and it inserts the values of the row into the table. It has a date range column that it updates to show for what time period the record was the listed value. With this implementation, the most up to date record is always the record that is in the main table, not the history table. -The trigger also has functionality to only create a record if the data was actually changed. In practice, this doesn't work for our implementation as meta data columns like `modified_by` and `modified_dts` can be changed without changing any other actual data. This effectively results in multiple empty historic entries. +The trigger also has functionality to only create a record if the data was actually changed. In practice, this doesn't work for our implementation as meta data columns like `modified_by` and `modified_dts` can be changed without changing any other actual data. This effectively results in multiple empty historic entries. ### Handling data migrations @@ -31,13 +31,13 @@ The solution natively handles data changes in a variety of ways. a. Other attempts were made to have two separate types, one with historic values ( all past values, and all new current ones) i. This didn't work, as the trigger currently requires the data to be the same type in the main table and the historic table ii. Similarly, this didn't work when trying to insert an enum value in the main table to a string value in the history table as the types were changed. - + ### POC Branch As part of exploration of the use of temporal tables, [a POC branch was made here](https://github.com/CMSgov/mint-app/tree/EASI-2900/temporal_tables_poc). -A [utility](https://github.com/CMSgov/mint-app/tree/EASI-2900/temporal_tables_poc/cmd/temporalSimulator) was created to explore how the database would handle migrations. +A [utility](https://github.com/CMSgov/mint-app/tree/EASI-2900/temporal_tables_poc/cmd/temporalSimulator) was created to explore how the database would handle migrations. To explore the functionality, you can build it like this ` go build -a -o bin/tSim ./cmd/temporalSimulator ` @@ -48,7 +48,7 @@ This branch also has a couple different versions of the trigger to highlight som ### Possible Implementation Changes 1. Update the trigger to use a configuration like exists in `audit.table_config` currently to specify additional columns to ignore. ([implemented here](https://github.com/CMSgov/mint-app/blob/EASI-2900/temporal_tables_poc/migrations/V96__Temporal_Tables_Modified.sql)) 2. Update the trigger to be run after an update instead of before. Insert the current up to date value in the table, with an indefinite time range. - + a. This would have the benefit of only needing to search the one table to get the entire view of an object in just one table instead of needing to query the main table and the history table. (This also introduces complexity, so it's benefit needs to be weighed) 3. Combine the audit paradigms. Temporal tables provide us a moment in time snapshot. The audit change table current provides the benefit of clearly showing who made a change, and when. diff --git a/scripts/dev b/scripts/dev index 094beace9a..f6ddc63344 100755 --- a/scripts/dev +++ b/scripts/dev @@ -452,7 +452,6 @@ end desc "Build the Go application" task :build do - sh("go build -a -o bin/mint ./cmd/mint") end