-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a12215b
commit b7d2c51
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
...grate/20250224131628_add_determination_period_days_to_local_authority_application_type.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,22 @@ | ||
# frozen_string_literal: true | ||
|
||
class AddDeterminationPeriodDaysToLocalAuthorityApplicationType < ActiveRecord::Migration[7.2] | ||
def change | ||
add_column :local_authority_application_types, :determination_period_days, :integer | ||
|
||
reversible do |dir| | ||
dir.up do | ||
LocalAuthority.find_each do |local_authority| | ||
next if local_authority.application_type_overrides.blank? | ||
|
||
local_authority.application_type_overrides.each do |override| | ||
application_type = ApplicationType.find_by(code: override.code) | ||
next unless application_type | ||
|
||
application_type.update!(determination_period_days: override.determination_period_days) | ||
end | ||
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