diff --git a/app/components/timeline_entry/component.rb b/app/components/timeline_entry/component.rb index fdc5ac0df0..d93d0f3537 100644 --- a/app/components/timeline_entry/component.rb +++ b/app/components/timeline_entry/component.rb @@ -46,16 +46,14 @@ def state_changed_vars old_state: 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_state: 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 2e0a1949cd..768eab2c48 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 2eba07d5dd..32b2dd23fe 100644 --- a/config/analytics.yml +++ b/config/analytics.yml @@ -380,10 +380,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 8620b61695..612c5d49ce 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_084340) 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" @@ -475,8 +475,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 f6999db248..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[state_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 59d4f20f71..34c81b4c47 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 2ae0e59910..b409028d2f 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