DEV: Promote historic post_deploy migrations (#30959)

This commit promotes all post_deploy migrations which existed in
Discourse v3.3.0 (timestamp <= 20240717053710)
This commit is contained in:
Roman Rizzi
2025-01-24 10:57:12 -03:00
committed by GitHub
parent 2f19b17cd7
commit 42fb6c9822
7 changed files with 0 additions and 0 deletions

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
class DropBadgeImageColumn < ActiveRecord::Migration[7.0]
DROPPED_COLUMNS = { badges: %i[image] }
def up
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
end
def down
raise ActiveRecord::IrreversibleMigration
end
end

View File

@ -0,0 +1,28 @@
# frozen_string_literal: true
class DropDeprecatedColumns < ActiveRecord::Migration[7.0]
DROPPED_COLUMNS = {
categories: %i[suppress_from_latest required_tag_group_id min_tags_from_required_group],
directory_columns: %i[automatic],
email_tokens: %i[token],
embeddable_hosts: %i[path_whitelist],
groups: %i[flair_url],
invites: %i[user_id redeemed_at],
posts: %i[avg_time image_url],
tags: %i[topic_count],
topic_users: %i[highest_seen_post_number],
topics: %i[avg_time image_url],
user_api_keys: %i[scopes],
user_options: %i[disable_jump_reply sidebar_list_destination],
user_profiles: %i[badge_granted_title],
user_stats: %i[topic_reply_count],
}
def up
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
end
def down
raise ActiveRecord::IrreversibleMigration
end
end

View File

@ -0,0 +1,20 @@
# frozen_string_literal: true
class ClearOrphanedDraftUploadReferences < ActiveRecord::Migration[7.0]
def up
execute <<~SQL
DELETE
FROM
"upload_references"
WHERE
"upload_references"."target_type" = 'Draft' AND
"upload_references"."target_id" NOT IN (
SELECT "drafts"."id" FROM "drafts"
)
SQL
end
def down
raise ActiveRecord::IrreversibleMigration
end
end

View File

@ -0,0 +1,19 @@
# frozen_string_literal: true
class SwapFieldTypeWithFieldTypeEnumOnUserFields < ActiveRecord::Migration[7.0]
def change
end
# DROPPED_COLUMNS = { user_fields: %i[field_type] }
# def up
# # WARNING: Swapping in a column of a different type in a post-migration will break the AR
# # cache, since the application is already booted, requiring a restart.
# #
# DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
# rename_column :user_fields, :field_type_enum, :field_type
# end
# def down
# raise ActiveRecord::IrreversibleMigration
# end
end

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
class DropCompiledJsFromTranslationOverrides < ActiveRecord::Migration[7.1]
DROPPED_COLUMNS = { translation_overrides: %i[compiled_js] }
def up
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
end
def down
raise ActiveRecord::IrreversibleMigration
end
end

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
class DropCustomTypeFromFlags < ActiveRecord::Migration[7.0]
DROPPED_COLUMNS = { flags: %i[custom_type] }
def up
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
end
def down
raise ActiveRecord::IrreversibleMigration
end
end

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
class DropGroupsSmtpSsl < ActiveRecord::Migration[7.1]
DROPPED_COLUMNS = { groups: %i[smtp_ssl] }
def up
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
end
def down
raise ActiveRecord::IrreversibleMigration
end
end