diff --git a/app/components/timeline_entry/component.rb b/app/components/timeline_entry/component.rb index a33d562087..f74f929da4 100644 --- a/app/components/timeline_entry/component.rb +++ b/app/components/timeline_entry/component.rb @@ -46,16 +46,14 @@ def status_changed_vars old_status: render( StatusTag::Component.new( - status: - timeline_event.old_state.presence || timeline_event.old_value, + status: timeline_event.old_value, class_context: "timeline-event", ), ).strip, new_status: render( StatusTag::Component.new( - status: - timeline_event.new_state.presence || timeline_event.new_value, + status: timeline_event.new_value, class_context: "timeline-event", ), ).strip, diff --git a/app/models/timeline_event.rb b/app/models/timeline_event.rb index 03cac4cbab..a1723aa904 100644 --- a/app/models/timeline_event.rb +++ b/app/models/timeline_event.rb @@ -15,9 +15,7 @@ # mailer_action_name :string default(""), not null # mailer_class_name :string default(""), not null # message_subject :string default(""), not null -# new_state :string default(""), not null # new_value :text default(""), not null -# old_state :string default(""), not null # old_value :text default(""), not null # requestable_type :string # subjects :text default([]), not null, is an Array diff --git a/config/analytics.yml b/config/analytics.yml index 07e9a844e8..700f141f34 100644 --- a/config/analytics.yml +++ b/config/analytics.yml @@ -381,10 +381,8 @@ - mailer_action_name - mailer_class_name - message_subject - - new_state - new_value - note_id - - old_state - old_value - requestable_id - requestable_type diff --git a/db/migrate/20230920152618_remove_state_from_timeline_events.rb b/db/migrate/20230920152618_remove_state_from_timeline_events.rb new file mode 100644 index 0000000000..d1939ad391 --- /dev/null +++ b/db/migrate/20230920152618_remove_state_from_timeline_events.rb @@ -0,0 +1,8 @@ +class RemoveStateFromTimelineEvents < ActiveRecord::Migration[7.0] + def change + change_table :timeline_events, bulk: true do |t| + t.remove :old_state, type: :string, default: "", null: false + t.remove :new_state, type: :string, default: "", null: false + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 1fe8ddfc16..11db9d712c 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[7.0].define(version: 2023_09_14_104107) do +ActiveRecord::Schema[7.0].define(version: 2023_09_20_152618) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -476,8 +476,6 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.bigint "assignee_id" - t.string "old_state", default: "", null: false - t.string "new_state", default: "", null: false t.bigint "assessment_section_id" t.bigint "note_id" t.string "creator_name", default: "", null: false diff --git a/lib/tasks/timeline_events.rake b/lib/tasks/timeline_events.rake deleted file mode 100644 index 4f3d15437c..0000000000 --- a/lib/tasks/timeline_events.rake +++ /dev/null @@ -1,15 +0,0 @@ -namespace :timeline_events do - desc "Migrate old_state/new_state" - task migrate_old_new_state: :environment do - TimelineEvent - .where(event_type: %w[status_changed assessment_section_recorded]) - .each do |timeline_event| - timeline_event.update!( - old_value: timeline_event.old_state, - new_value: timeline_event.new_state, - old_state: "", - new_state: "", - ) - end - end -end diff --git a/spec/factories/timeline_events.rb b/spec/factories/timeline_events.rb index 1829d1d557..8d50696250 100644 --- a/spec/factories/timeline_events.rb +++ b/spec/factories/timeline_events.rb @@ -13,9 +13,7 @@ # mailer_action_name :string default(""), not null # mailer_class_name :string default(""), not null # message_subject :string default(""), not null -# new_state :string default(""), not null # new_value :text default(""), not null -# old_state :string default(""), not null # old_value :text default(""), not null # requestable_type :string # subjects :text default([]), not null, is an Array diff --git a/spec/models/timeline_event_spec.rb b/spec/models/timeline_event_spec.rb index a0f20cde2c..a66160619c 100644 --- a/spec/models/timeline_event_spec.rb +++ b/spec/models/timeline_event_spec.rb @@ -13,9 +13,7 @@ # mailer_action_name :string default(""), not null # mailer_class_name :string default(""), not null # message_subject :string default(""), not null -# new_state :string default(""), not null # new_value :text default(""), not null -# old_state :string default(""), not null # old_value :text default(""), not null # requestable_type :string # subjects :text default([]), not null, is an Array