Skip to content

Commit

Permalink
GIAS import also stores UKPRN
Browse files Browse the repository at this point in the history
  • Loading branch information
asmega committed Jun 27, 2024
1 parent 5895f1e commit 80d536a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/models/school_data_importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def row_to_school(row)
school.statutory_high_age = row.fetch("StatutoryHighAge")
school.phone_number = row.fetch("TelephoneNum")
school.open_date = row.fetch("OpenDate")
school.ukprn = row.fetch("UKPRN")
school
end
end
1 change: 1 addition & 0 deletions config/analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ shared:
- statutory_high_age
- phone_number
- open_date
- ukprn
:support_tickets:
- id
- url
Expand Down
7 changes: 7 additions & 0 deletions db/migrate/20240627114644_add_ukprn_to_schools.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class AddUkprnToSchools < ActiveRecord::Migration[7.0]
def change
add_column :schools, :ukprn, :text, null: true

add_index :schools, :ukprn
end
end
4 changes: 3 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_06_24_105924) do
ActiveRecord::Schema[7.0].define(version: 2024_06_27_114644) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
enable_extension "pgcrypto"
Expand Down Expand Up @@ -368,13 +368,15 @@
t.string "phone_number", limit: 20
t.date "open_date"
t.string "postcode_sanitised"
t.text "ukprn"
t.index ["close_date"], name: "index_schools_on_close_date"
t.index ["created_at"], name: "index_schools_on_created_at"
t.index ["local_authority_district_id"], name: "index_schools_on_local_authority_district_id"
t.index ["local_authority_id"], name: "index_schools_on_local_authority_id"
t.index ["name"], name: "index_schools_on_name", opclass: :gin_trgm_ops, using: :gin
t.index ["open_date"], name: "index_schools_on_open_date"
t.index ["postcode_sanitised"], name: "index_schools_on_postcode_sanitised", opclass: :gin_trgm_ops, using: :gin
t.index ["ukprn"], name: "index_schools_on_ukprn"
t.index ["urn"], name: "index_schools_on_urn", unique: true
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
expect(imported_school.statutory_high_age).to eq(18)
expect(imported_school.phone_number).to eq("01226762114")
expect(imported_school.open_date).to be_nil
expect(imported_school.ukprn).to eql("10005034")
end

it "imports a closed school with the date it closed" do
Expand Down

0 comments on commit 80d536a

Please sign in to comment.