mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 03:06:45 +08:00
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:
13
db/migrate/20240202052058_drop_badge_image_column.rb
Normal file
13
db/migrate/20240202052058_drop_badge_image_column.rb
Normal 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
|
28
db/migrate/20240212034010_drop_deprecated_columns.rb
Normal file
28
db/migrate/20240212034010_drop_deprecated_columns.rb
Normal 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
|
@ -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
|
@ -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
|
@ -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
|
13
db/migrate/20240714231516_drop_custom_type_from_flags.rb
Normal file
13
db/migrate/20240714231516_drop_custom_type_from_flags.rb
Normal 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
|
13
db/migrate/20240717053710_drop_groups_smtp_ssl.rb
Normal file
13
db/migrate/20240717053710_drop_groups_smtp_ssl.rb
Normal 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
|
Reference in New Issue
Block a user