このコミットが含まれているのは:
@@ -0,0 +1,53 @@
|
||||
class RepairWikiUpdatedAt < ActiveRecord::Migration[8.0]
|
||||
class WikiPage < ActiveRecord::Base
|
||||
self.table_name = 'wiki_pages'
|
||||
end
|
||||
|
||||
class WikiVersion < ActiveRecord::Base
|
||||
self.table_name = 'wiki_versions'
|
||||
end
|
||||
|
||||
class TagDescription < ActiveRecord::Base
|
||||
self.table_name = 'tag_descriptions'
|
||||
end
|
||||
|
||||
class TagDescriptionVersion < ActiveRecord::Base
|
||||
self.table_name = 'tag_description_versions'
|
||||
end
|
||||
|
||||
def up
|
||||
say_with_time 'Repairing wiki_pages.updated_at from wiki_versions' do
|
||||
WikiPage.find_each do |page|
|
||||
version =
|
||||
WikiVersion
|
||||
.where(wiki_page_id: page.id)
|
||||
.order(version_no: :desc)
|
||||
.first
|
||||
|
||||
next unless version
|
||||
|
||||
page.update_columns(updated_at: version.created_at)
|
||||
end
|
||||
end
|
||||
|
||||
say_with_time 'Repairing tag_descriptions.updated_at from tag_description_versions' do
|
||||
TagDescription.find_each do |description|
|
||||
version =
|
||||
TagDescriptionVersion
|
||||
.where(
|
||||
tag_id: description.tag_id,
|
||||
language_code: description.language_code)
|
||||
.order(version_no: :desc)
|
||||
.first
|
||||
|
||||
next unless version
|
||||
|
||||
description.update_columns(updated_at: version.created_at)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
;
|
||||
end
|
||||
end
|
||||
生成ファイル
+1
-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_10_03_010000) do
|
||||
ActiveRecord::Schema[8.0].define(version: 2026_10_05_000000) 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
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする