-
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.
Migrate data to local_authority_application_types table
- Loading branch information
1 parent
6f5dfb8
commit b895842
Showing
5 changed files
with
25 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
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
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,6 @@ | ||
# frozen_string_literal: true | ||
|
||
class LocalAuthorityApplicationType < ApplicationRecord | ||
belongs_to :local_authority | ||
belongs_to :application_type | ||
end |
12 changes: 12 additions & 0 deletions
12
db/migrate/20250224104514_migrate_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,12 @@ | ||
# frozen_string_literal: true | ||
|
||
class MigrateLocalAuthorityApplicationType < ActiveRecord::Migration[7.2] | ||
def change | ||
PlanningApplication.find_each do |planning_application| | ||
LocalAuthorityApplicationType.create!( | ||
local_authority_id: planning_application.local_authority_id, | ||
application_type_id: planning_application.application_type_id | ||
) | ||
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