DEV: attempt to work around poison schema cache in migration

DEV: attempt to work around poison schema cache in migration

Ideally we should not have this code in migrations

diff --git a/db/migrate/20200226183018_create_calendar_events.rb b/db/migrate/20200226183018_create_calendar_events.rb
index 5546b2b..3261640 100644
--- a/db/migrate/20200226183018_create_calendar_events.rb
+++ b/db/migrate/20200226183018_create_calendar_events.rb
@@ -32,7 +32,10 @@ class CreateCalendarEvents < ActiveRecord::Migration[5.2]
            OR post_custom_fields.name = 'calendar-holidays'
       SQL
 
+      # this is not ideal we should be using SQL here but this will work around bad schema
+      ActiveRecord::Base.clear_cache!
       Post.where(topic_id: calendar_topic_ids).each { |post| CalendarEvent.update(post) }
+      ActiveRecord::Base.clear_cache!
 
       execute "DELETE FROM post_custom_fields WHERE name = 'calendar-details' OR name = 'calendar-holidays'"
     rescue => e

GitHub sha: fcbab755