us_geo 2.0.0 → 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: 2dfc74542cb99a60205494e209802884c849a4bd0f05f06fc1bb644d7ad27e62
4
- data.tar.gz: 39e6ca65501f0244529893ba3eb4b1a3ff07aa836649f8beeaad70ed380e9b69
3
+ metadata.gz: 711c99585d65af3e17634a5ae2a3d18927e2b110561b0514a045e8bcd5d1374f
4
+ data.tar.gz: b44bd355b23abf0d66dfad0a0f128877fe52243324a94e6be9c55064ee2a525d
5
5
  SHA512:
6
- metadata.gz: 4fdf470e2c5773e4ca335b89dfdd79ba67205160bc894118be7898ccddaabd5a81fecc448ce2ab8fc775823935b6df60f493fdfd4647f90c1d35e35254a53f10
7
- data.tar.gz: 7424c521ab4736f001392640240de3ba1255656babacbd2eef45b036a260060ac57e73e0bd147f3cc4f5811dcbd79da2a0a13009dbcfeea8f27196972d1bfac4
6
+ metadata.gz: 70a6b4d77c0ce0493d36d7459f62cf54a34d7f1e19cecbccc30184329134177092d7bb77eda0110c7c939d0002f3d932360ef7d3aa7f5b9ae89f9d99d932d92c
7
+ data.tar.gz: '09443a88e94d09406a9630d2c1290c4641e0111e9f18b4239dc25d0c4667b5759cea11bc9c9036497c082ee78d9bc31e7c091276538a3b93e18812488af19df8'
data/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@ 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
+
13
+ ## 2.0.1
14
+
15
+ ### Added
16
+
17
+ - Indexes on `us_geo_zctas` on `primary_place_geoid` and on `primary_county_subdivision_geoid`.
18
+
7
19
  ## 2.0.0
8
20
 
9
21
  ### Changed
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.0.2
@@ -4,10 +4,10 @@ class AddZctaPrimaryPlace < ActiveRecord::Migration[5.0]
4
4
  def up
5
5
  return if column_exists?(:us_geo_zctas, :primary_place_geoid)
6
6
 
7
- add_column :us_geo_zctas, :primary_place_geoid, :string, limit: 7, null: true, index: true
7
+ add_column :us_geo_zctas, :primary_place_geoid, :string, limit: 7, null: true
8
8
  end
9
9
 
10
10
  def down
11
- add_column :us_geo_zctas, :primary_place_geoid, :string, limit: 7, null: true, index: true
11
+ remove_column :us_geo_zctas, :primary_place_geoid
12
12
  end
13
13
  end
@@ -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"
@@ -3,11 +3,11 @@
3
3
  class AddZctaPrimaryCountySubdivision < ActiveRecord::Migration[5.0]
4
4
  def up
5
5
  unless column_exists?(:us_geo_zctas, :primary_county_subdivision_geoid)
6
- add_column :us_geo_zctas, :primary_county_subdivision_geoid, :string, limit: 10, null: true, index: true
6
+ add_column :us_geo_zctas, :primary_county_subdivision_geoid, :string, limit: 10, null: true
7
7
  end
8
8
  end
9
9
 
10
10
  def down
11
- add_column :us_geo_zctas, :primary_county_subdivision_geoid, :string, limit: 10, null: true, index: true
11
+ remove_column :us_geo_zctas, :primary_county_subdivision_geoid
12
12
  end
13
13
  end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddIndexOnZctasGeoids < ActiveRecord::Migration[5.0]
4
+ def up
5
+ unless index_exists?(:us_geo_zctas, :primary_place_geoid)
6
+ add_index :us_geo_zctas, :primary_place_geoid
7
+ end
8
+
9
+ unless index_exists?(:us_geo_zctas, :primary_county_subdivision_geoid)
10
+ add_index :us_geo_zctas, :primary_county_subdivision_geoid
11
+ end
12
+ end
13
+
14
+ def down
15
+ remove_index :us_geo_zctas, :primary_place_geoid
16
+ remove_index :us_geo_zctas, :primary_county_subdivision_geoid
17
+ end
18
+ end
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.0
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
@@ -82,6 +82,7 @@ files:
82
82
  - db/migrate/20230417000400_allow_null_urban_area_counties_demographics.rb
83
83
  - db/migrate/20230417000500_allow_null_zcta_urban_areas_demographics.rb
84
84
  - db/migrate/20230417000600_add_additional_time_zone_name_to_counties.rb
85
+ - db/migrate/20230426000100_add_index_on_zctas_geoids.rb
85
86
  - db/schema.rb
86
87
  - explorer_app/.gitattributes
87
88
  - explorer_app/.gitignore