Skip to content

Commit 456a4e4

Browse files
authored
Turn Job Preferences Location UK Area to Geometry (#8438)
## Trello card URL - Sentry errors: - https://teaching-vacancies.sentry.io/issues/7194829661 - https://teaching-vacancies.sentry.io/issues/7194436126 ## Changes in this PR: The polygon type was causing errors when the incoming area was a multipolygon. Resolving it by converting it to the Geometry type, as done for the Subscription UK area. ## Checklists: ### Data & Schema Changes If this PR modifies data structures or validations, check the following: - [ ] Adds/removes model validations - [ ] Adds/removes database fields - [ ] Modifies Vacancy enumerables (phases, working patterns, job roles, key stages, etc.) <details> <summary>If any of the above options has changed then the author must check/resolve all of the following...</summary> ### Integration Impact Does this change affect any of these integrations? - [ ] DfE Analytics platform - [ ] Legacy imports mappings - [ ] DWP Find a Job export mappings - [ ] Publisher ATS API (may require mapping updates or API versioning) ### User Experience & Data Integrity Could this change impact: - [ ] Existing subscription alerts (will legacy subscription search filters break?) - [ ] Legacy vacancy copying (will copied vacancies fail new validations?) - [ ] In-progress drafts for Vacancies or Job Applications </details>
1 parent 8d8f83b commit 456a4e4

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class ChangeJobPreferencesLocationsUkAreaType < ActiveRecord::Migration[8.0]
2+
disable_ddl_transaction!
3+
4+
def change
5+
add_column :job_preferences_locations, :new_uk_area, :geometry, srid: 27_700
6+
add_index :job_preferences_locations, :new_uk_area, using: :gist, algorithm: :concurrently
7+
remove_index :job_preferences_locations, :uk_area, algorithm: :concurrently
8+
safety_assured do
9+
remove_column :job_preferences_locations, :uk_area, :st_polygon, srid: 27_700
10+
rename_column :job_preferences_locations, :new_uk_area, :uk_area
11+
end
12+
end
13+
end

db/schema.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[8.0].define(version: 2026_01_15_140453) do
13+
ActiveRecord::Schema[8.0].define(version: 2026_01_20_090246) do
1414
# These are extensions that must be enabled in order to support this database
1515
enable_extension "btree_gist"
1616
enable_extension "citext"
@@ -331,7 +331,7 @@
331331
t.geography "area", limit: {srid: 4326, type: "geometry", geographic: true}, null: false
332332
t.datetime "created_at", null: false
333333
t.datetime "updated_at", null: false
334-
t.geometry "uk_area", limit: {srid: 27700, type: "st_polygon"}
334+
t.geometry "uk_area", limit: {srid: 27700, type: "geometry"}
335335
t.index ["area"], name: "index_job_preferences_locations_on_area", using: :gist
336336
t.index ["job_preferences_id"], name: "index_job_preferences_locations_on_job_preferences_id"
337337
t.index ["uk_area"], name: "index_job_preferences_locations_on_uk_area", using: :gist

0 commit comments

Comments
 (0)