DEV: Drop unused columns
This commit is contained in:
parent
ce83fd93bb
commit
ea11ad4d99
|
@ -63,7 +63,6 @@ module Jobs
|
||||||
.joins("LEFT JOIN post_uploads pu ON pu.upload_id = uploads.id")
|
.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 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_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 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 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")
|
.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("u.uploaded_avatar_id IS NULL")
|
||||||
.where("ua.gravatar_upload_id IS NULL AND ua.custom_upload_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("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("c.uploaded_logo_id IS NULL AND c.uploaded_background_id IS NULL")
|
||||||
.where("ce.upload_id IS NULL")
|
.where("ce.upload_id IS NULL")
|
||||||
.where("tf.upload_id IS NULL")
|
.where("tf.upload_id IS NULL")
|
||||||
|
|
|
@ -6,7 +6,6 @@ class Category < ActiveRecord::Base
|
||||||
]
|
]
|
||||||
|
|
||||||
self.ignored_columns = %w{
|
self.ignored_columns = %w{
|
||||||
uploaded_meta_id
|
|
||||||
suppress_from_latest
|
suppress_from_latest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Invite < ActiveRecord::Base
|
class Invite < ActiveRecord::Base
|
||||||
self.ignored_columns = %w{
|
|
||||||
via_email
|
|
||||||
}
|
|
||||||
|
|
||||||
class UserExists < StandardError; end
|
class UserExists < StandardError; end
|
||||||
include RateLimiter::OnCreateRecord
|
include RateLimiter::OnCreateRecord
|
||||||
include Trashable
|
include Trashable
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class UserAction < ActiveRecord::Base
|
class UserAction < ActiveRecord::Base
|
||||||
|
|
||||||
self.ignored_columns = %w{
|
|
||||||
queued_post_id
|
|
||||||
}
|
|
||||||
|
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :target_post, class_name: "Post"
|
belongs_to :target_post, class_name: "Post"
|
||||||
belongs_to :target_topic, class_name: "Topic"
|
belongs_to :target_topic, class_name: "Topic"
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class UserProfile < ActiveRecord::Base
|
class UserProfile < ActiveRecord::Base
|
||||||
self.ignored_columns = %w{
|
|
||||||
card_background
|
|
||||||
profile_background
|
|
||||||
}
|
|
||||||
|
|
||||||
belongs_to :user, inverse_of: :user_profile
|
belongs_to :user, inverse_of: :user_profile
|
||||||
belongs_to :card_background_upload, class_name: "Upload"
|
belongs_to :card_background_upload, class_name: "Upload"
|
||||||
belongs_to :profile_background_upload, class_name: "Upload"
|
belongs_to :profile_background_upload, class_name: "Upload"
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue