diff --git a/app/models/alt_style.rb b/app/models/alt_style.rb index 75bfb0b9..1f31c562 100644 --- a/app/models/alt_style.rb +++ b/app/models/alt_style.rb @@ -6,23 +6,11 @@ class AltStyle < ApplicationRecord has_many :swf_assets, through: :parent_swf_asset_relationships has_many :contributions, as: :contributed, inverse_of: :contributed - SERIES_ID_RANGES = { - nostalgic: (87249..87503) - } - def name I18n.translate('pet_types.human_name', color_human_name: color.human_name, species_human_name: species.human_name) end - def series_name - if SERIES_ID_RANGES[:nostalgic].include?(id) - "Nostalgic" - else - "???" - end - end - def adjective_name "#{series_name} #{color.human_name}" end diff --git a/db/migrate/20240227231815_add_series_name_to_alt_styles.rb b/db/migrate/20240227231815_add_series_name_to_alt_styles.rb new file mode 100644 index 00000000..5c389680 --- /dev/null +++ b/db/migrate/20240227231815_add_series_name_to_alt_styles.rb @@ -0,0 +1,18 @@ +class AddSeriesNameToAltStyles < ActiveRecord::Migration[7.1] + def change + add_column :alt_styles, :series_name, :string, null: false, + default: "" + + reversible do |direction| + direction.up do + # These IDs are determined by Neopets.com, so referencing them like + # this should be relatively stable! Backfill the series name + # "Nostalgic" for all alt styles in the Nostalgic ID range. (At time + # of writing, *all* alt styles are Nostalgic, but I'm writing it like + # this for clarity and future-proofing!) + AltStyle.where("id >= 87249 AND id <= 87503").update_all( + series_name: "Nostalgic") + end + end + end +end diff --git a/db/schema.rb b/db/schema.rb index cab8166e..81c41f62 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,13 +10,14 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_02_25_231346) do +ActiveRecord::Schema[7.1].define(version: 2024_02_27_231815) do create_table "alt_styles", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.integer "species_id", null: false t.integer "color_id", null: false t.integer "body_id", null: false t.datetime "created_at", precision: nil, null: false t.datetime "updated_at", precision: nil, null: false + t.string "series_name", default: "", null: false t.index ["color_id"], name: "index_alt_styles_on_color_id" t.index ["species_id"], name: "index_alt_styles_on_species_id" end @@ -115,6 +116,20 @@ ActiveRecord::Schema[7.1].define(version: 2024_02_25_231346) do t.index ["outfit_id", "is_worn"], name: "index_item_outfit_relationships_on_outfit_id_and_is_worn" end + create_table "item_translations", id: :integer, charset: "latin1", collation: "latin1_swedish_ci", force: :cascade do |t| + t.integer "item_id" + t.string "locale" + t.string "name" + t.text "description" + t.string "rarity" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil + t.index ["item_id", "locale"], name: "index_item_translations_on_item_id_and_locale" + t.index ["item_id"], name: "index_item_translations_on_item_id" + t.index ["locale"], name: "index_item_translations_on_locale" + t.index ["name"], name: "index_item_translations_name" + end + create_table "items", id: :integer, charset: "utf8mb3", collation: "utf8mb3_unicode_ci", force: :cascade do |t| t.text "zones_restrict", null: false t.text "thumbnail_url", size: :medium, null: false