Exclude large tables when remapping in `Upload.migrate_to_new_scheme`.

Exclude large tables when remapping in Upload.migrate_to_new_scheme.

Those tables do not carry any information about uploads.

diff --git a/app/models/upload.rb b/app/models/upload.rb
index e33dcda..76003d1 100644
--- a/app/models/upload.rb
+++ b/app/models/upload.rb
@@ -276,6 +276,18 @@ class Upload < ActiveRecord::Base
               excluded_tables: %w{
                 posts
                 post_search_data
+                incoming_emails
+                notifications
+                single_sign_on_records
+                stylesheet_cache
+                topic_links
+                topics
+                topic_search_data
+                users
+                user_emails
+                user_profiles
+                draft_sequences
+                optimized_images
               }
             )

GitHub sha: 4a03b21f

1 Like

Hmmm… I think some of these tables could include uploads

  • stylesheet_cache could contain references to uploaded images (e.g. in themes)

  • topic_links could be links to uploads - skipping them will mean we lose the click counters

  • topics contains an image_url field

  • user_profiles contains profile_background and card_background (which are URLs, not foreign keys). Users could also link to uploads from their bios

1 Like
  • stylesheet_cache is introduced after the upload has moved to the new scheme so it is not possible for uploads on the old scheme to exist in the cache.

  • Good point about topic_links, didn’t know the upload URLs are tracked as well.

  • topics anduser_profiles` shouldn’t be in there. I think I accidentally add them in by mistake when profiling. Thanks for catching this.

2 Likes

Remove tables incorrectly excluded in `Upload.migrate_to_new_scheme`.