FIX: amend resetting of cache

We need to reset the column info cache for posts so we can run the update
This commit is contained in:
Sam Saffron 2020-04-30 12:45:02 +10:00
parent fcbab7559d
commit 97de973eb2
No known key found for this signature in database
GPG Key ID: B9606168D2FFD9F5
1 changed files with 2 additions and 2 deletions

View File

@ -33,9 +33,9 @@ class CreateCalendarEvents < ActiveRecord::Migration[5.2]
SQL
# this is not ideal we should be using SQL here but this will work around bad schema
ActiveRecord::Base.clear_cache!
ActiveRecord::Base.connection.query_cache.clear
Post.reset_column_information
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