Sha256: 75ccff2bf9d900ad7a8c98e0493aa382db3926b3f41b139d7444377ec3e6e8a4
Contents?: true
Size: 1.11 KB
Versions: 47
Compression:
Stored size: 1.11 KB
Contents
module Para class PostgresExtensionsChecker class << self def check_all Para::LogConfig.with_log_level(:fatal) do %w(hstore unaccent).each do |extname| unless extension_exists?(extname) # Could not use Rails.logger here, using puts as a temporary # solution. puts "[Warning] PostgreSQL \"#{ extname }\" extension is not " + "installed in your database. This means that you " + "missing some migrations that you can install " + "with the following command : " + "`rake para_engine:install:migrations` and then migrate." end end end end private def extension_exists?(extname) result = ActiveRecord::Base.connection.execute( "SELECT COUNT(*) FROM pg_catalog.pg_extension " + "WHERE extname = '#{ extname }'" ).first result && result['count'].to_i > 0 rescue ActiveRecord::NoDatabaseError true # Do not issue warning when no database is installed end end end end
Version data entries
47 entries across 47 versions & 1 rubygems