Sha256: 1d6af3e8151d088c9f3dbfdde20751826be063071369620ea659289213502f8d
Contents?: true
Size: 1.11 KB
Versions: 9
Compression:
Stored size: 1.11 KB
Contents
class AddEarthdistance < ActiveRecord::Migration def self.up # comented out to avoid PG::InsufficientPrivilege-ERROR # add with cap postgresql:add_extensions # => execute "CREATE EXTENSION IF NOT EXISTS cube" # => execute "CREATE EXTENSION IF NOT EXISTS earthdistance" if Rails.env.development? || Rails.env.test? enable_extension "cube" enable_extension "earthdistance" end unless index_exists?(:mgca_addresses, [:latitude,:longitude], name: "mgca_addresses_earthdistance_ix") add_earthdistance_index :mgca_addresses, lat: 'latitude', lng: 'longitude' end end def self.down # => execute "DROP EXTENSION IF EXISTS earthdistance" # => execute "DROP EXTENSION IF EXISTS cube" # comented out in staging and production to avoid PG::InsufficientPrivilege-ERROR .. add with cap postgresql:remove_extensions if Rails.env.development? || Rails.env.test? disable_extension "earthdistance" disable_extension "cube" end remove_index :mgca_addresses, [:latitude,:longitude], name: "mgca_addresses_earthdistance_ix" end end
Version data entries
9 entries across 9 versions & 1 rubygems