Compare commits

...

3 commits

Author SHA1 Message Date
c8e53165c7 Drop item_translations table
Okay cool, we're successfully migrated off translations, we can delete
the table now!

I'm not worried about backing up this data as such, because the
impress-2020 repo has a bunch of this data in its
`public-data-from-modeling.sql.gz` file history. Safe to remove from
the live app!
2024-02-20 17:01:54 -08:00
f85703d2cc Remove now-unused globalize dependency
We previously used this to translate fields on some models: Color,
Species, Zone, and Item.

We no longer do, so we can safely remove the gem!
2024-02-20 16:58:39 -08:00
1e6ff4cefc Remove the Item::Translation model entirely
Okay, Impress 2020 is migrated off translations too, so we can start to
wrap this up!
2024-02-20 16:57:45 -08:00
7 changed files with 18 additions and 48 deletions

View file

@ -31,7 +31,6 @@ gem 'will_paginate', '~> 4.0'
# For translation, both for the site UI and for Neopets data.
gem 'rails-i18n', '~> 7.0', '>= 7.0.7'
gem 'http_accept_language', '~> 2.1', '>= 2.1.1'
gem 'globalize', '~> 6.2', '>= 6.2.1'
# For reading and parsing HTML from Neopets.com, like importing Closet pages.
gem 'nokogiri', '~> 1.15', '>= 1.15.3'

View file

@ -157,10 +157,6 @@ GEM
fiber-local (1.0.0)
globalid (1.2.1)
activesupport (>= 6.1)
globalize (6.3.0)
activemodel (>= 4.2, < 7.2)
activerecord (>= 4.2, < 7.2)
request_store (~> 1.0)
haml (6.1.1)
temple (>= 0.8.2)
thor
@ -292,8 +288,6 @@ GEM
actionview (>= 5)
reline (0.3.9)
io-console (~> 0.5)
request_store (1.5.1)
rack (>= 1.4)
responders (3.1.1)
actionpack (>= 5.2)
railties (>= 5.2)
@ -368,7 +362,6 @@ DEPENDENCIES
devise-encryptable (~> 0.2.0)
dotenv-rails (~> 2.8, >= 2.8.1)
falcon (~> 0.42.3)
globalize (~> 6.2, >= 6.2.1)
haml (~> 6.1, >= 6.1.1)
http_accept_language (~> 2.1, >= 2.1.1)
httparty (~> 0.21.0)

View file

@ -5,13 +5,6 @@ class Item < ApplicationRecord
self.inheritance_column = nil
SwfAssetType = 'object'
# Keep the reference to the deprecated `Item::Translation` record, but don't
# bind it directly to any attributes anymore. We have some temporary writers
# that hack around the API to keep the attributes synced, while no longer
# reading *from* them by default.
# TODO: Remove once we're all done with translations, both here and in 2020!
translates
has_many :closet_hangers
has_one :contribution, :as => :contributed, :inverse_of => :contributed
@ -112,24 +105,6 @@ class Item < ApplicationRecord
distinct
}
# Temporary writers to keep the English translation record updated, while
# primarily using the attributes on the model itself.
#
# Once this app and DTI 2020 are both comfortably off the translation system,
# we can remove this!
def name=(new_name)
globalize.write(:en, :name, new_name)
write_attribute(:name, new_name)
end
def description=(new_description)
globalize.write(:en, :description, new_description)
write_attribute(:description, new_description)
end
def rarity=(new_rarity)
globalize.write(:en, :rarity, new_rarity)
write_attribute(:rarity, new_rarity)
end
def nc_trade_value
return nil unless nc?
begin

View file

@ -0,0 +1,17 @@
class DropItemTranslations < ActiveRecord::Migration[7.1]
def change
drop_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
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.1].define(version: 2024_02_21_004332) do
ActiveRecord::Schema[7.1].define(version: 2024_02_21_005949) 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
@ -115,20 +115,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_02_21_004332) 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

Binary file not shown.

Binary file not shown.