-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename events_order to events_list_order and readd events_order
`events_order` determines how to select events for outputting, whereas `events_list_order` determines how to list selected events in the output.
- Loading branch information
Showing
3 changed files
with
51 additions
and
12 deletions.
There are no files selected for viewing
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
25 changes: 25 additions & 0 deletions
25
db/migrate/20160607055850_change_events_order_to_events_list_order.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,25 @@ | ||
class ChangeEventsOrderToEventsListOrder < ActiveRecord::Migration | ||
def up | ||
Agents::DataOutputAgent.find_each do |agent| | ||
if value = agent.options.delete('events_order') | ||
agent.options['events_list_order'] = value | ||
agent.save!(validate: false) | ||
end | ||
end | ||
end | ||
|
||
def down | ||
Agents::DataOutputAgent.transaction do | ||
Agents::DataOutputAgent.find_each do |agent| | ||
if agent.options['events_order'] | ||
raise ActiveRecord::IrreversibleMigration, "Cannot revert migration because events_order is configured" | ||
end | ||
|
||
if value = agent.options.delete('events_list_order') | ||
agent.options['events_order'] = value | ||
agent.save!(validate: false) | ||
end | ||
end | ||
end | ||
end | ||
end |
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