mirror of
https://github.com/discourse/discourse.git
synced 2025-02-17 01:42:46 +08:00
PERF: Exclude tables when remapping in migrate_to_s3
rake task.
This commit is contained in:
parent
9737938a4a
commit
0232a3b5e5
|
@ -226,6 +226,14 @@ def migrate_to_s3
|
|||
s3 = FileStore::S3Store.new
|
||||
local = FileStore::LocalStore.new
|
||||
|
||||
exclude_tables = %i{
|
||||
incoming_emails
|
||||
stylesheet_cache
|
||||
search_logs
|
||||
post_search_data
|
||||
notifications
|
||||
}
|
||||
|
||||
# Migrate all uploads
|
||||
Upload.where.not(sha1: nil)
|
||||
.where("url NOT LIKE '#{s3.absolute_base_url}%'")
|
||||
|
@ -257,9 +265,14 @@ def migrate_to_s3
|
|||
end
|
||||
|
||||
# remap the URL
|
||||
DbHelper.remap(UrlHelper.absolute(from), Discourse.store.cdn_url(to))
|
||||
DbHelper.remap(UrlHelper.absolute_without_cdn(from), Discourse.store.cdn_url(to))
|
||||
DbHelper.remap(from, to)
|
||||
[
|
||||
[UrlHelper.absolute(from), Discourse.store.cdn_url(to)],
|
||||
[UrlHelper.absolute_without_cdn(from), Discourse.store.cdn_url(to)],
|
||||
[from, to],
|
||||
].each do |from_url, to_url|
|
||||
DbHelper.remap(from_url, to_url, exclude_tables: exclude_tables)
|
||||
end
|
||||
|
||||
upload.optimized_images.destroy_all
|
||||
|
||||
putc "."
|
||||
|
|
Loading…
Reference in New Issue
Block a user