Improved migration to work also with postgresql.
This commit is contained in:
parent
f91536ff39
commit
46c85048fd
1 changed files with 14 additions and 1 deletions
|
@ -1,6 +1,8 @@
|
||||||
# Rails dropped the class
|
# Rails dropped the class
|
||||||
# ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::MysqlDateTime
|
# ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::MysqlDateTime
|
||||||
# via: https://github.com/rails/rails/commit/f1a0fa9e19b7e4ccaea191fc6cf0613880222ee7
|
# 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.
|
# which we use in stored Cti::Log instance preferences.
|
||||||
# Since we don't need the instances but just an Hash we have to:
|
# Since we don't need the instances but just an Hash we have to:
|
||||||
# - create a dummy class
|
# - create a dummy class
|
||||||
|
@ -17,12 +19,23 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
end
|
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]
|
class CtiLogPreferencesMigration < ActiveRecord::Migration[5.0]
|
||||||
|
|
||||||
def change
|
def change
|
||||||
# correct all entries
|
# 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
|
||||||
next if item.preferences.blank?
|
next if item.preferences.blank?
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue