us_geo 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73084a715b73e960f52bf49b61e83d9bf68814a95a5ba9a6c702e721f9fe4c14
4
- data.tar.gz: 3e525d12df7a407afdfd67116a1f54f8c17de9def115a433fb0678b215267eff
3
+ metadata.gz: 711c99585d65af3e17634a5ae2a3d18927e2b110561b0514a045e8bcd5d1374f
4
+ data.tar.gz: b44bd355b23abf0d66dfad0a0f128877fe52243324a94e6be9c55064ee2a525d
5
5
  SHA512:
6
- metadata.gz: 4a2c90967678930d21c7c3560d785a4fb8551f71cf017f1e9a8ef975f637bb215b3ef90376140a67cdbd6740f1ae4206407f7da25ef027804d8b788a525c73b8
7
- data.tar.gz: e1ec086a0af3dff1ad76af089caa510af3175f2b82f5afa6489752bd562dbb6662cc374cd6b55a0ec6392f3e289318c93387b2a6b9b0b684fe15e2422a2955e5
6
+ metadata.gz: 70a6b4d77c0ce0493d36d7459f62cf54a34d7f1e19cecbccc30184329134177092d7bb77eda0110c7c939d0002f3d932360ef7d3aa7f5b9ae89f9d99d932d92c
7
+ data.tar.gz: '09443a88e94d09406a9630d2c1290c4641e0111e9f18b4239dc25d0c4667b5759cea11bc9c9036497c082ee78d9bc31e7c091276538a3b93e18812488af19df8'
data/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## 2.0.2
8
+
9
+ ### Fixed
10
+
11
+ - Migrations that update existing data are now compatible with Rails versions prior to 7.0.
12
+
7
13
  ## 2.0.1
8
14
 
9
15
  ### Added
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.1
1
+ 2.0.2
@@ -6,10 +6,12 @@ class AddShortNameToCoreBasedStatisticalAreas < ActiveRecord::Migration[5.0]
6
6
 
7
7
  add_column :us_geo_core_based_statistical_areas, :short_name, :string, null: true
8
8
 
9
+ update_sql = "UPDATE us_geo_core_based_statistical_areas SET short_name = ? WHERE geoid = ?"
10
+
9
11
  select_all("SELECT geoid, name FROM us_geo_core_based_statistical_areas").each do |row|
10
12
  city, state = row["name"].split(", ", 2)
11
13
  short_name = "#{city.split("-").first}, #{state.split("-").first}"
12
- update("UPDATE us_geo_core_based_statistical_areas SET short_name = ? WHERE geoid = ?", nil, [short_name, row["geoid"]])
14
+ update ActiveRecord::Base.sanitize_sql([update_sql, short_name, row["geoid"]])
13
15
  end
14
16
 
15
17
  change_column_null :us_geo_core_based_statistical_areas, :short_name, false
@@ -6,10 +6,12 @@ class AddShortNameToCombinedStatisticalAreas < ActiveRecord::Migration[5.0]
6
6
 
7
7
  add_column :us_geo_combined_statistical_areas, :short_name, :string, null: true
8
8
 
9
+ update_sql = "UPDATE us_geo_combined_statistical_areas SET short_name = ? WHERE geoid = ?"
10
+
9
11
  select_all("SELECT geoid, name FROM us_geo_combined_statistical_areas").each do |row|
10
12
  city, state = row["name"].split(", ", 2)
11
13
  short_name = "#{city.split("-").first}, #{state.split("-").first}"
12
- update("UPDATE us_geo_combined_statistical_areas SET short_name = ? WHERE geoid = ?", nil, [short_name, row["geoid"]])
14
+ update ActiveRecord::Base.sanitize_sql([update_sql, short_name, row["geoid"]])
13
15
  end
14
16
 
15
17
  change_column_null :us_geo_combined_statistical_areas, :short_name, false
@@ -13,8 +13,10 @@ class AddUniqueNameIndexToCountySubdivisions < ActiveRecord::Migration[5.0]
13
13
  AND t1.name = t2.name
14
14
  SQL
15
15
 
16
+ update_sql = "UPDATE us_geo_county_subdivisions SET name = ? WHERE geoid = ?"
17
+
16
18
  select_all(duplicates_sql).each do |row|
17
- update("UPDATE us_geo_county_subdivisions SET name = ? WHERE geoid = ?", nil, ["#{row["name"]} (duplicate)", row["geoid"]])
19
+ update ActiveRecord::Base.sanitize_sql([update_sql, "#{row["name"]} (duplicate)", row["geoid"]])
18
20
  end
19
21
 
20
22
  add_index :us_geo_county_subdivisions, [:name, :county_geoid], unique: true, name: "index_us_geo_county_subdivisions_on_unique_name"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: us_geo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Durand
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-27 00:00:00.000000000 Z
11
+ date: 2023-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord