From 0396acf39ea902688374fac65fa7ef5dc4c05512 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 25 Aug 2022 20:39:40 +0200 Subject: Add audit log entries for user roles (#19040) * Refactor audit log schema * Add audit log entries for user roles --- .../20220824164433_add_human_identifier_to_admin_action_logs.rb | 7 +++++++ ...20824164532_remove_recorded_changes_from_admin_action_logs.rb | 9 +++++++++ db/schema.rb | 6 ++++-- 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20220824164433_add_human_identifier_to_admin_action_logs.rb create mode 100644 db/post_migrate/20220824164532_remove_recorded_changes_from_admin_action_logs.rb (limited to 'db') diff --git a/db/migrate/20220824164433_add_human_identifier_to_admin_action_logs.rb b/db/migrate/20220824164433_add_human_identifier_to_admin_action_logs.rb new file mode 100644 index 000000000..2cb8cddf1 --- /dev/null +++ b/db/migrate/20220824164433_add_human_identifier_to_admin_action_logs.rb @@ -0,0 +1,7 @@ +class AddHumanIdentifierToAdminActionLogs < ActiveRecord::Migration[6.1] + def change + add_column :admin_action_logs, :human_identifier, :string + add_column :admin_action_logs, :route_param, :string + add_column :admin_action_logs, :permalink, :string + end +end diff --git a/db/post_migrate/20220824164532_remove_recorded_changes_from_admin_action_logs.rb b/db/post_migrate/20220824164532_remove_recorded_changes_from_admin_action_logs.rb new file mode 100644 index 000000000..c42d5df8f --- /dev/null +++ b/db/post_migrate/20220824164532_remove_recorded_changes_from_admin_action_logs.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class RemoveRecordedChangesFromAdminActionLogs < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + + def change + safety_assured { remove_column :admin_action_logs, :recorded_changes, :text } + end +end diff --git a/db/schema.rb b/db/schema.rb index 15ab2e85e..83fd9549c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2022_08_08_101323) do +ActiveRecord::Schema.define(version: 2022_08_24_164532) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -205,9 +205,11 @@ ActiveRecord::Schema.define(version: 2022_08_08_101323) do t.string "action", default: "", null: false t.string "target_type" t.bigint "target_id" - t.text "recorded_changes", default: "", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.string "human_identifier" + t.string "route_param" + t.string "permalink" t.index ["account_id"], name: "index_admin_action_logs_on_account_id" t.index ["target_type", "target_id"], name: "index_admin_action_logs_on_target_type_and_target_id" end -- cgit