demarches-normaliennes/db/migrate/20230704093503_enable_postgis.rb
2024-08-22 09:26:48 +02:00

9 lines
317 B
Ruby

# frozen_string_literal: true
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
end
end