chore: update AWS SDK dependencies and improve schema
- Downgraded `aws-sdk-s3` to version 1.170 and updated `aws-sdk-core` to 3.211 to maintain compatibility with existing code. - Updated various column types in the database schema from `integer` to `bigint` to handle larger values and improve data integrity. - Modified the `sync_geo_data.rake` task to use `find_or_create_by` for `Country`, improving the logic for ensuring unique countries based on ISO code. These changes enhance dependency management and improve schema robustness while maintaining functionality.
This commit is contained in:
parent
edbfb32d65
commit
3f1e8892f9
3
Gemfile
3
Gemfile
@ -56,7 +56,8 @@ gem "ahoy_matey", "~> 5.2"
|
||||
gem "ruby-openai", "~> 7.3"
|
||||
gem "httparty", "~> 0.22.0"
|
||||
gem "down", "~> 5.4"
|
||||
gem "aws-sdk-s3", "~> 1.177"
|
||||
gem "aws-sdk-s3", "~> 1.170"
|
||||
gem "aws-sdk-core", "3.211"
|
||||
gem "sidekiq", "~> 7.3"
|
||||
gem "sidekiq-scheduler", "~> 5.0"
|
||||
|
||||
|
13
Gemfile.lock
13
Gemfile.lock
@ -94,16 +94,16 @@ GEM
|
||||
ast (2.4.2)
|
||||
aws-eventstream (1.3.0)
|
||||
aws-partitions (1.1044.0)
|
||||
aws-sdk-core (3.217.1)
|
||||
aws-sdk-core (3.211.0)
|
||||
aws-eventstream (~> 1, >= 1.3.0)
|
||||
aws-partitions (~> 1, >= 1.992.0)
|
||||
aws-sigv4 (~> 1.9)
|
||||
jmespath (~> 1, >= 1.6.1)
|
||||
aws-sdk-kms (1.97.0)
|
||||
aws-sdk-core (~> 3, >= 3.216.0)
|
||||
aws-sdk-kms (1.96.0)
|
||||
aws-sdk-core (~> 3, >= 3.210.0)
|
||||
aws-sigv4 (~> 1.5)
|
||||
aws-sdk-s3 (1.179.0)
|
||||
aws-sdk-core (~> 3, >= 3.216.0)
|
||||
aws-sdk-s3 (1.177.0)
|
||||
aws-sdk-core (~> 3, >= 3.210.0)
|
||||
aws-sdk-kms (~> 1)
|
||||
aws-sigv4 (~> 1.5)
|
||||
aws-sigv4 (1.11.0)
|
||||
@ -511,7 +511,8 @@ PLATFORMS
|
||||
DEPENDENCIES
|
||||
activeadmin (~> 3.2)
|
||||
ahoy_matey (~> 5.2)
|
||||
aws-sdk-s3 (~> 1.177)
|
||||
aws-sdk-core (= 3.211)
|
||||
aws-sdk-s3 (~> 1.170)
|
||||
bootsnap
|
||||
brakeman
|
||||
capybara
|
||||
|
27
db/schema.rb
generated
27
db/schema.rb
generated
@ -11,13 +11,16 @@
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.0].define(version: 2025_02_08_052634) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_catalog.plpgsql"
|
||||
|
||||
create_table "active_admin_comments", force: :cascade do |t|
|
||||
t.string "namespace"
|
||||
t.text "body"
|
||||
t.string "resource_type"
|
||||
t.integer "resource_id"
|
||||
t.bigint "resource_id"
|
||||
t.string "author_type"
|
||||
t.integer "author_id"
|
||||
t.bigint "author_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["author_type", "author_id"], name: "index_active_admin_comments_on_author"
|
||||
@ -66,8 +69,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_02_08_052634) do
|
||||
end
|
||||
|
||||
create_table "ahoy_events", force: :cascade do |t|
|
||||
t.integer "visit_id"
|
||||
t.integer "user_id"
|
||||
t.bigint "visit_id"
|
||||
t.bigint "user_id"
|
||||
t.string "name"
|
||||
t.text "properties"
|
||||
t.datetime "time"
|
||||
@ -79,7 +82,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_02_08_052634) do
|
||||
create_table "ahoy_visits", force: :cascade do |t|
|
||||
t.string "visit_token"
|
||||
t.string "visitor_token"
|
||||
t.integer "user_id"
|
||||
t.bigint "user_id"
|
||||
t.string "ip"
|
||||
t.text "user_agent"
|
||||
t.text "referrer"
|
||||
@ -117,12 +120,12 @@ ActiveRecord::Schema[8.0].define(version: 2025_02_08_052634) do
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "slug"
|
||||
t.integer "country_id", null: false
|
||||
t.bigint "country_id", null: false
|
||||
t.string "state_code"
|
||||
t.string "country_code"
|
||||
t.boolean "flag", default: true
|
||||
t.string "wiki_data_id"
|
||||
t.integer "state_id"
|
||||
t.bigint "state_id"
|
||||
t.index ["country_id"], name: "index_cities_on_country_id"
|
||||
t.index ["slug"], name: "index_cities_on_slug", unique: true
|
||||
t.index ["state_id"], name: "index_cities_on_state_id"
|
||||
@ -132,7 +135,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_02_08_052634) do
|
||||
t.string "name"
|
||||
t.string "code"
|
||||
t.string "slug"
|
||||
t.integer "region_id"
|
||||
t.bigint "region_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "iso3"
|
||||
@ -155,7 +158,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_02_08_052634) do
|
||||
t.string "emoji_u"
|
||||
t.boolean "flag", default: true
|
||||
t.string "wiki_data_id"
|
||||
t.integer "subregion_id"
|
||||
t.bigint "subregion_id"
|
||||
t.index ["code"], name: "index_countries_on_code", unique: true
|
||||
t.index ["region_id"], name: "index_countries_on_region_id"
|
||||
t.index ["slug"], name: "index_countries_on_slug", unique: true
|
||||
@ -189,7 +192,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_02_08_052634) do
|
||||
create_table "states", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "code"
|
||||
t.integer "country_id"
|
||||
t.bigint "country_id"
|
||||
t.string "country_code"
|
||||
t.string "fips_code"
|
||||
t.string "iso2"
|
||||
@ -208,7 +211,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_02_08_052634) do
|
||||
create_table "subregions", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.text "translations"
|
||||
t.integer "region_id", null: false
|
||||
t.bigint "region_id", null: false
|
||||
t.boolean "flag", default: true
|
||||
t.string "wiki_data_id"
|
||||
t.datetime "created_at", null: false
|
||||
@ -217,7 +220,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_02_08_052634) do
|
||||
end
|
||||
|
||||
create_table "weather_arts", force: :cascade do |t|
|
||||
t.integer "city_id", null: false
|
||||
t.bigint "city_id", null: false
|
||||
t.date "weather_date"
|
||||
t.string "description"
|
||||
t.decimal "temperature"
|
||||
|
@ -84,7 +84,8 @@ namespace :geo do
|
||||
count += 1
|
||||
|
||||
# 查找或初始化 Country
|
||||
country = Country.find_or_initialize_by(name: data["name"]) do |c|
|
||||
country = Country.find_or_create_by(code: data["iso2"]) do |c|
|
||||
c.name = data["name"]
|
||||
end
|
||||
|
||||
# 更新 Country 属性
|
||||
|
Loading…
Reference in New Issue
Block a user