-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Write migration for renamed COP cutoff input in quintel/etsource#3030 (…
- Loading branch information
Showing
2 changed files
with
20 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
require 'etengine/scenario_migration' | ||
|
||
class RenameCutoffCopInput < ActiveRecord::Migration[7.0] | ||
include ETEngine::ScenarioMigration | ||
|
||
KEYS = { | ||
'flexibility_heat_pump_space_heating_cop_cutoff' => 'flexibility_heat_pump_space_heating_cop_cutoff_gas', | ||
}.freeze | ||
|
||
def up | ||
migrate_scenarios do |scenario| | ||
KEYS.each do |old_key, new_key| | ||
if scenario.user_values.key?(old_key) | ||
scenario.user_values[new_key] = scenario.user_values.delete(old_key) | ||
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