mirror of
https://github.com/discourse/discourse.git
synced 2025-06-05 14:07:30 +08:00
FIX: Create readonly functions during backup
Temporarily recreate already dropped functions in the discourse_functions schema in order to allow restoring of backups which still reference dropped functions.
This commit is contained in:
@ -4,24 +4,23 @@ require 'migration/column_dropper'
|
||||
require 'badge_posts_view_manager'
|
||||
|
||||
class RemoveSuperfluousColumns < ActiveRecord::Migration[5.2]
|
||||
def up
|
||||
{
|
||||
user_profiles: %i{
|
||||
DROPPED_COLUMNS ||= {
|
||||
user_profiles: %i{
|
||||
card_image_badge_id
|
||||
},
|
||||
categories: %i{
|
||||
categories: %i{
|
||||
logo_url
|
||||
background_url
|
||||
suppress_from_homepage
|
||||
},
|
||||
groups: %i{
|
||||
groups: %i{
|
||||
visible
|
||||
public
|
||||
alias_level
|
||||
},
|
||||
theme_fields: %i{target},
|
||||
user_stats: %i{first_topic_unread_at},
|
||||
topics: %i{
|
||||
theme_fields: %i{target},
|
||||
user_stats: %i{first_topic_unread_at},
|
||||
topics: %i{
|
||||
auto_close_at
|
||||
auto_close_user_id
|
||||
auto_close_started_at
|
||||
@ -35,7 +34,7 @@ class RemoveSuperfluousColumns < ActiveRecord::Migration[5.2]
|
||||
last_unread_at
|
||||
vote_count
|
||||
},
|
||||
users: %i{
|
||||
users: %i{
|
||||
email
|
||||
email_always
|
||||
mailing_list_mode
|
||||
@ -58,23 +57,27 @@ class RemoveSuperfluousColumns < ActiveRecord::Migration[5.2]
|
||||
silenced
|
||||
trust_level_locked
|
||||
},
|
||||
user_auth_tokens: %i{legacy},
|
||||
user_options: %i{theme_key},
|
||||
themes: %i{key},
|
||||
email_logs: %i{
|
||||
user_auth_tokens: %i{legacy},
|
||||
user_options: %i{theme_key},
|
||||
themes: %i{key},
|
||||
email_logs: %i{
|
||||
topic_id
|
||||
reply_key
|
||||
skipped
|
||||
skipped_reason
|
||||
},
|
||||
}.each do |table, columns|
|
||||
posts: %i{vote_count}
|
||||
}
|
||||
|
||||
def up
|
||||
BadgePostsViewManager.drop!
|
||||
|
||||
DROPPED_COLUMNS.each do |table, columns|
|
||||
Migration::ColumnDropper.execute_drop(table, columns)
|
||||
end
|
||||
|
||||
DB.exec "DROP FUNCTION IF EXISTS first_unread_topic_for(int)"
|
||||
|
||||
BadgePostsViewManager.drop!
|
||||
Migration::ColumnDropper.execute_drop(:posts, %i{vote_count})
|
||||
BadgePostsViewManager.create!
|
||||
end
|
||||
|
||||
|
@ -3,12 +3,14 @@
|
||||
require 'migration/table_dropper'
|
||||
|
||||
class RemoveSuperfluousTables < ActiveRecord::Migration[5.2]
|
||||
def up
|
||||
%i{
|
||||
DROPPED_TABLES ||= %i{
|
||||
category_featured_users
|
||||
versions
|
||||
topic_status_updates
|
||||
}.each do |table|
|
||||
}
|
||||
|
||||
def up
|
||||
DROPPED_TABLES.each do |table|
|
||||
Migration::TableDropper.execute_drop(table)
|
||||
end
|
||||
end
|
||||
|
@ -3,8 +3,14 @@
|
||||
require 'migration/column_dropper'
|
||||
|
||||
class DropGroupLockedTrustLevelFromUser < ActiveRecord::Migration[5.2]
|
||||
DROPPED_COLUMNS ||= {
|
||||
posts: %i{group_locked_trust_level}
|
||||
}
|
||||
|
||||
def up
|
||||
Migration::ColumnDropper.execute_drop(:posts, %i{group_locked_trust_level})
|
||||
DROPPED_COLUMNS.each do |table, columns|
|
||||
Migration::ColumnDropper.execute_drop(table, columns)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
|
@ -3,8 +3,14 @@
|
||||
require 'migration/column_dropper'
|
||||
|
||||
class RemoveUploadedMetaIdFromCategory < ActiveRecord::Migration[5.2]
|
||||
DROPPED_COLUMNS ||= {
|
||||
categories: %i{uploaded_meta_id}
|
||||
}
|
||||
|
||||
def up
|
||||
Migration::ColumnDropper.execute_drop(:categories, %i{uploaded_meta_id})
|
||||
DROPPED_COLUMNS.each do |table, columns|
|
||||
Migration::ColumnDropper.execute_drop(table, columns)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
|
@ -3,11 +3,13 @@
|
||||
require 'migration/table_dropper'
|
||||
|
||||
class DropUnusedAuthTablesAgain < ActiveRecord::Migration[5.2]
|
||||
def up
|
||||
%i{
|
||||
DROPPED_TABLES ||= %i{
|
||||
facebook_user_infos
|
||||
twitter_user_infos
|
||||
}.each do |table|
|
||||
}
|
||||
|
||||
def up
|
||||
DROPPED_TABLES.each do |table|
|
||||
Migration::TableDropper.execute_drop(table)
|
||||
end
|
||||
end
|
||||
|
@ -3,14 +3,16 @@
|
||||
require 'migration/column_dropper'
|
||||
|
||||
class DropEmailUserOptionsColumns < ActiveRecord::Migration[5.2]
|
||||
def up
|
||||
{
|
||||
user_options: %i{
|
||||
DROPPED_COLUMNS ||= {
|
||||
user_options: %i{
|
||||
email_direct
|
||||
email_private_messages
|
||||
email_always
|
||||
},
|
||||
}.each do |table, columns|
|
||||
}
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each do |table, columns|
|
||||
Migration::ColumnDropper.execute_drop(table, columns)
|
||||
end
|
||||
end
|
||||
|
@ -3,8 +3,14 @@
|
||||
require 'migration/column_dropper'
|
||||
|
||||
class RemoveViaEmailFromInvite < ActiveRecord::Migration[5.2]
|
||||
DROPPED_COLUMNS ||= {
|
||||
invites: %i{via_email}
|
||||
}
|
||||
|
||||
def up
|
||||
Migration::ColumnDropper.execute_drop(:invites, %i{via_email})
|
||||
DROPPED_COLUMNS.each do |table, columns|
|
||||
Migration::ColumnDropper.execute_drop(table, columns)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
|
Reference in New Issue
Block a user