diff --git a/app/jobs/scheduled/clean_up_uploads.rb b/app/jobs/scheduled/clean_up_uploads.rb index cf10d24d44f..acf986a4141 100644 --- a/app/jobs/scheduled/clean_up_uploads.rb +++ b/app/jobs/scheduled/clean_up_uploads.rb @@ -63,7 +63,6 @@ module Jobs .joins("LEFT JOIN post_uploads pu ON pu.upload_id = uploads.id") .joins("LEFT JOIN users u ON u.uploaded_avatar_id = uploads.id") .joins("LEFT JOIN user_avatars ua ON ua.gravatar_upload_id = uploads.id OR ua.custom_upload_id = uploads.id") - .joins("LEFT JOIN user_profiles up2 ON up2.profile_background = uploads.url OR up2.card_background = uploads.url") .joins("LEFT JOIN user_profiles up ON up.profile_background_upload_id = uploads.id OR up.card_background_upload_id = uploads.id") .joins("LEFT JOIN categories c ON c.uploaded_logo_id = uploads.id OR c.uploaded_background_id = uploads.id") .joins("LEFT JOIN custom_emojis ce ON ce.upload_id = uploads.id") @@ -73,7 +72,6 @@ module Jobs .where("u.uploaded_avatar_id IS NULL") .where("ua.gravatar_upload_id IS NULL AND ua.custom_upload_id IS NULL") .where("up.profile_background_upload_id IS NULL AND up.card_background_upload_id IS NULL") - .where("up2.profile_background IS NULL AND up2.card_background IS NULL") .where("c.uploaded_logo_id IS NULL AND c.uploaded_background_id IS NULL") .where("ce.upload_id IS NULL") .where("tf.upload_id IS NULL") diff --git a/app/models/category.rb b/app/models/category.rb index 455e50cbe8b..025512d0fbc 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -6,7 +6,6 @@ class Category < ActiveRecord::Base ] self.ignored_columns = %w{ - uploaded_meta_id suppress_from_latest } diff --git a/app/models/invite.rb b/app/models/invite.rb index b442f26208e..bced2785df1 100644 --- a/app/models/invite.rb +++ b/app/models/invite.rb @@ -1,10 +1,6 @@ # frozen_string_literal: true class Invite < ActiveRecord::Base - self.ignored_columns = %w{ - via_email - } - class UserExists < StandardError; end include RateLimiter::OnCreateRecord include Trashable diff --git a/app/models/user_action.rb b/app/models/user_action.rb index fef91feb9e4..5346c066258 100644 --- a/app/models/user_action.rb +++ b/app/models/user_action.rb @@ -1,11 +1,6 @@ # frozen_string_literal: true class UserAction < ActiveRecord::Base - - self.ignored_columns = %w{ - queued_post_id - } - belongs_to :user belongs_to :target_post, class_name: "Post" belongs_to :target_topic, class_name: "Topic" diff --git a/app/models/user_profile.rb b/app/models/user_profile.rb index ad2701e70d4..bb276d30ca9 100644 --- a/app/models/user_profile.rb +++ b/app/models/user_profile.rb @@ -1,11 +1,6 @@ # frozen_string_literal: true class UserProfile < ActiveRecord::Base - self.ignored_columns = %w{ - card_background - profile_background - } - belongs_to :user, inverse_of: :user_profile belongs_to :card_background_upload, class_name: "Upload" belongs_to :profile_background_upload, class_name: "Upload" diff --git a/db/post_migrate/20200120131338_drop_unused_columns.rb b/db/post_migrate/20200120131338_drop_unused_columns.rb new file mode 100644 index 00000000000..096f3ee4a6d --- /dev/null +++ b/db/post_migrate/20200120131338_drop_unused_columns.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class DropUnusedColumns < ActiveRecord::Migration[6.0] + DROPPED_COLUMNS ||= { + post_replies: %i{ + reply_id + }, + user_profiles: %i{ + card_background + profile_background + } + } + + def up + DROPPED_COLUMNS.each do |table, columns| + Migration::ColumnDropper.execute_drop(table, columns) + end + end + + def down + raise ActiveRecord::IrreversibleMigration + end +end