demarches-normaliennes/db/migrate/20230704093503_enable_postgis.rb

10 lines
317 B
Ruby
Raw Permalink Normal View History

# frozen_string_literal: true
2023-07-04 11:38:18 +02:00
class EnablePostgis < ActiveRecord::Migration[7.0]
def change
if ENV['POSTGIS_EXTENSION_DISABLED'] != 'disabled' && ActiveRecord::Base.connection.execute("SELECT 1 as one FROM pg_extension WHERE extname = 'postgis';").count.zero?
enable_extension :postgis
end
2023-07-04 11:38:18 +02:00
end
end