Skip to content

Commit

Permalink
Remove old_state and new_state
Browse files Browse the repository at this point in the history
These fields have been replaced with old_value and new_value, this
avoids the need to have multiple fields for storing the same thing.
  • Loading branch information
thomasleese committed Sep 28, 2023
1 parent a07a0fb commit 02b57c2
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 30 deletions.
6 changes: 2 additions & 4 deletions app/components/timeline_entry/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions app/models/timeline_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions config/analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
4 changes: 1 addition & 3 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 0 additions & 15 deletions lib/tasks/timeline_events.rake

This file was deleted.

2 changes: 0 additions & 2 deletions spec/factories/timeline_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions spec/models/timeline_event_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 02b57c2

Please sign in to comment.