このコミットが含まれているのは:
2026-09-28 00:30:03 +09:00
コミット 28e638e360
18個のファイルの変更、209行の追加、68行の削除
+36
ファイルの表示
@@ -0,0 +1,36 @@
class AddNamesToTagVersions < ActiveRecord::Migration[8.0]
class TagVersion < ActiveRecord::Base
self.table_name = 'tag_versions'
end
def up
add_column :tag_versions, :names, :json
TagVersion.reset_column_information
say_with_time 'Backfilling multilingual tag version names' do
TagVersion.find_each do |version|
names = [{
language_code: 'ja',
name: version.name,
script_code: 'Jpan',
primary_flg: true }]
names.concat(version.aliases.to_s.split.filter_map { |name|
next if name.blank?
{
language_code: 'ja',
name:,
script_code: 'Jpan',
primary_flg: false }
})
version.update_columns(names: names)
end
end
change_column_null :tag_versions, :names, false
end
def down
remove_column :tag_versions, :names
end
end
生成ファイル
+2 -1
ファイルの表示
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2026_09_22_030000) do
ActiveRecord::Schema[8.0].define(version: 2026_09_22_040000) do
create_table "active_storage_attachments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "name", null: false
t.string "record_type", null: false
@@ -480,6 +480,7 @@ ActiveRecord::Schema[8.0].define(version: 2026_09_22_030000) do
t.datetime "deprecated_at"
t.datetime "created_at", null: false
t.bigint "created_by_user_id"
t.json "names", null: false
t.index ["created_at"], name: "index_tag_versions_on_created_at"
t.index ["created_by_user_id", "created_at"], name: "index_tag_versions_on_created_by_user_id_and_created_at", order: { created_at: :desc }
t.index ["tag_id", "created_at"], name: "index_tag_versions_on_tag_id_and_created_at", order: { created_at: :desc }