lib/chrono_model/json.rb in chrono_model-1.2.2 vs lib/chrono_model/json.rb in chrono_model-2.0.0

- old
+ new

@@ -1,28 +1,31 @@ -module ChronoModel +# frozen_string_literal: true +module ChronoModel module Json extend self def create - puts "ChronoModel: WARNING - JSON ops are deprecated. Please migrate to JSONB" + ActiveSupport::Deprecation.warn <<-MSG.squish + ChronoModel: JSON ops are deprecated. Please migrate to JSONB. + MSG adapter.execute 'CREATE OR REPLACE LANGUAGE plpythonu' - adapter.execute File.read(sql 'json_ops.sql') + adapter.execute File.read(sql('json_ops.sql')) end def drop - adapter.execute File.read(sql 'uninstall-json_ops.sql') + adapter.execute File.read(sql('uninstall-json_ops.sql')) adapter.execute 'DROP LANGUAGE IF EXISTS plpythonu' end private + def sql(file) - File.dirname(__FILE__) + '/../../sql/' + file + "#{File.dirname(__FILE__)}/../../sql/#{file}" end def adapter ActiveRecord::Base.connection end end - end