-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added logidze log_data column for workflow executions * Added tests and updated blacklisting of columns * Updated counts for log size and version that was missed in previous commit which blacklisted attachments_updated_at column * Fixed rubocop warnings * Regenerated new trigger and migration to whitelist the columns required * Updated to include deleted_at in whitelist and updated migration to create logidze snapshots for existing workflow executions * Updated db schema * Fixed rubocop warning * Fixed sql.squish rubocop warning
- Loading branch information
1 parent
d11b67d
commit 9c15cbf
Showing
7 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
db/migrate/20250109162252_add_logidze_to_workflow_executions.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# frozen_string_literal: true | ||
|
||
# Migration to add Logidze to WorkflowExecutions table | ||
class AddLogidzeToWorkflowExecutions < ActiveRecord::Migration[7.2] | ||
def change | ||
add_column :workflow_executions, :log_data, :jsonb | ||
|
||
reversible do |dir| | ||
dir.up do | ||
create_trigger :logidze_on_workflow_executions, on: :workflow_executions | ||
|
||
execute <<-SQL.squish | ||
UPDATE "workflow_executions" as t SET log_data = logidze_snapshot(to_jsonb(t), 'created_at', '{"run_id","name","state","deleted_at"}', true); | ||
SQL | ||
end | ||
|
||
dir.down do | ||
execute <<~SQL.squish | ||
DROP TRIGGER IF EXISTS "logidze_on_workflow_executions" on "workflow_executions"; | ||
SQL | ||
end | ||
end | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CREATE TRIGGER "logidze_on_workflow_executions" | ||
BEFORE UPDATE OR INSERT ON "workflow_executions" FOR EACH ROW | ||
WHEN (coalesce(current_setting('logidze.disabled', true), '') <> 'on') | ||
-- Parameters: history_size_limit (integer), timestamp_column (text), filtered_columns (text[]), | ||
-- include_columns (boolean), debounce_time_ms (integer) | ||
EXECUTE PROCEDURE logidze_logger(null, 'updated_at', '{run_id,name,state,deleted_at}', true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters