- Implement caching methods for last weather fetch and image generation - Adjust sleep duration in BatchGenerateWeatherArtsWorker from 10 seconds to 3 seconds - Remove unused fields `last_weather_fetch` and `last_image_generation` from the cities table - Add index on the weather_arts table for optimized querying This refactor improves data retrieval performance for weather data associated with cities. Caching reduces database load while the worker modification allows for faster iterations in generating weather arts without significantly impacting performance.
144 lines
5.8 KiB
Ruby
Generated
144 lines
5.8 KiB
Ruby
Generated
# This file is auto-generated from the current state of the database. Instead
|
|
# of editing this file, please use the migrations feature of Active Record to
|
|
# incrementally modify your database, and then regenerate this schema definition.
|
|
#
|
|
# This file is the source Rails uses to define your schema when running `bin/rails
|
|
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
|
# be faster and is potentially less error prone than running all of your
|
|
# migrations from scratch. Old migrations may fail to apply correctly if those
|
|
# migrations use external dependencies or application code.
|
|
#
|
|
# It's strongly recommended that you check this file into your version control system.
|
|
|
|
ActiveRecord::Schema[8.0].define(version: 2025_01_23_155234) do
|
|
create_table "active_admin_comments", force: :cascade do |t|
|
|
t.string "namespace"
|
|
t.text "body"
|
|
t.string "resource_type"
|
|
t.integer "resource_id"
|
|
t.string "author_type"
|
|
t.integer "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"
|
|
t.index ["namespace"], name: "index_active_admin_comments_on_namespace"
|
|
t.index ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource"
|
|
end
|
|
|
|
create_table "active_storage_attachments", force: :cascade do |t|
|
|
t.string "name", null: false
|
|
t.string "record_type", null: false
|
|
t.bigint "record_id", null: false
|
|
t.bigint "blob_id", null: false
|
|
t.datetime "created_at", null: false
|
|
t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
|
|
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
|
|
end
|
|
|
|
create_table "active_storage_blobs", force: :cascade do |t|
|
|
t.string "key", null: false
|
|
t.string "filename", null: false
|
|
t.string "content_type"
|
|
t.text "metadata"
|
|
t.string "service_name", null: false
|
|
t.bigint "byte_size", null: false
|
|
t.string "checksum"
|
|
t.datetime "created_at", null: false
|
|
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
|
|
end
|
|
|
|
create_table "active_storage_variant_records", force: :cascade do |t|
|
|
t.bigint "blob_id", null: false
|
|
t.string "variation_digest", null: false
|
|
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
|
|
end
|
|
|
|
create_table "admin_users", force: :cascade do |t|
|
|
t.string "email", default: "", null: false
|
|
t.string "encrypted_password", default: "", null: false
|
|
t.string "reset_password_token"
|
|
t.datetime "reset_password_sent_at"
|
|
t.datetime "remember_created_at"
|
|
t.datetime "created_at", null: false
|
|
t.datetime "updated_at", null: false
|
|
t.index ["email"], name: "index_admin_users_on_email", unique: true
|
|
t.index ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true
|
|
end
|
|
|
|
create_table "cities", force: :cascade do |t|
|
|
t.string "name"
|
|
t.float "latitude"
|
|
t.float "longitude"
|
|
t.boolean "active"
|
|
t.integer "priority"
|
|
t.string "timezone"
|
|
t.datetime "created_at", null: false
|
|
t.datetime "updated_at", null: false
|
|
t.string "slug"
|
|
t.integer "country_id", null: false
|
|
t.index ["country_id"], name: "index_cities_on_country_id"
|
|
t.index ["slug"], name: "index_cities_on_slug", unique: true
|
|
end
|
|
|
|
create_table "countries", force: :cascade do |t|
|
|
t.string "name"
|
|
t.string "code"
|
|
t.string "slug"
|
|
t.integer "region_id", null: false
|
|
t.datetime "created_at", null: false
|
|
t.datetime "updated_at", null: false
|
|
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
|
|
end
|
|
|
|
create_table "friendly_id_slugs", force: :cascade do |t|
|
|
t.string "slug", null: false
|
|
t.integer "sluggable_id", null: false
|
|
t.string "sluggable_type", limit: 50
|
|
t.string "scope"
|
|
t.datetime "created_at"
|
|
t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true
|
|
t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type"
|
|
t.index ["sluggable_type", "sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_type_and_sluggable_id"
|
|
end
|
|
|
|
create_table "regions", force: :cascade do |t|
|
|
t.string "name"
|
|
t.string "code"
|
|
t.string "slug"
|
|
t.datetime "created_at", null: false
|
|
t.datetime "updated_at", null: false
|
|
t.index ["code"], name: "index_regions_on_code", unique: true
|
|
t.index ["slug"], name: "index_regions_on_slug", unique: true
|
|
end
|
|
|
|
create_table "weather_arts", force: :cascade do |t|
|
|
t.integer "city_id", null: false
|
|
t.date "weather_date"
|
|
t.string "description"
|
|
t.decimal "temperature"
|
|
t.decimal "feeling_temp"
|
|
t.decimal "humidity"
|
|
t.string "wind_scale"
|
|
t.decimal "wind_speed"
|
|
t.decimal "precipitation"
|
|
t.decimal "pressure"
|
|
t.decimal "visibility"
|
|
t.decimal "cloud"
|
|
t.text "prompt"
|
|
t.datetime "created_at", null: false
|
|
t.datetime "updated_at", null: false
|
|
t.string "slug"
|
|
t.index ["city_id", "weather_date"], name: "index_weather_arts_on_city_id_and_weather_date"
|
|
t.index ["city_id"], name: "index_weather_arts_on_city_id"
|
|
t.index ["slug"], name: "index_weather_arts_on_slug", unique: true
|
|
end
|
|
|
|
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
|
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
|
add_foreign_key "cities", "countries"
|
|
add_foreign_key "countries", "regions"
|
|
add_foreign_key "weather_arts", "cities"
|
|
end
|