diff --git a/db/migrate/20170905140038_cti_log_preferences_migration.rb b/db/migrate/20170905140038_cti_log_preferences_migration.rb index 8e1dd0eeb..de4a70eea 100644 --- a/db/migrate/20170905140038_cti_log_preferences_migration.rb +++ b/db/migrate/20170905140038_cti_log_preferences_migration.rb @@ -1,6 +1,8 @@ # Rails dropped the class # ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::MysqlDateTime # via: https://github.com/rails/rails/commit/f1a0fa9e19b7e4ccaea191fc6cf0613880222ee7 +# ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer +# via: https://github.com/rails/rails/commit/aafee233fb3b4211ee0bfb1fca776c159bd1067e # which we use in stored Cti::Log instance preferences. # Since we don't need the instances but just an Hash we have to: # - create a dummy class @@ -17,12 +19,23 @@ module ActiveRecord end end end +module ActiveRecord + module ConnectionAdapters + module PostgreSQL + module OID + class Integer < Type::Integer + end + end + end + end +end class CtiLogPreferencesMigration < ActiveRecord::Migration[5.0] def change # correct all entries - Cti::Log.all.each do |item| + Cti::Log.all.pluck(:id).each do |item_id| + item = Cti::Log.find(item_id) next if !item.preferences next if item.preferences.blank?