Sha256: ac1a2575b86fe8216f6c85db80901f31ea6fd0c9dc210337ed0ba53fe27f529c

Contents?: true

Size: 578 Bytes

Versions: 4

Compression:

Stored size: 578 Bytes

Contents

module ChronoModel

  module Json
    extend self

    def create
      puts "ChronoModel: WARNING - JSON ops are deprecated. Please migrate to JSONB"

      adapter.execute 'CREATE OR REPLACE LANGUAGE plpythonu'
      adapter.execute File.read(sql 'json_ops.sql')
    end

    def drop
      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
    end

    def adapter
      ActiveRecord::Base.connection
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
chrono_model-1.2.2 lib/chrono_model/json.rb
chrono_model-1.2.1 lib/chrono_model/json.rb
chrono_model-1.2.0 lib/chrono_model/json.rb
chrono_model-1.1.0 lib/chrono_model/json.rb