podemos-info/participa2

View on GitHub
db/migrate/20180509103231_enable_pg_extensions.decidim_proposals.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

# This migration comes from decidim_proposals (originally 20171212102250)

class EnablePgExtensions < ActiveRecord::Migration[5.1]
  def change
    return if extension_enabled?("pg_trgm")

    begin
      # required so that test suite works in ci env
      enable_extension "pg_trgm"
    rescue StandardError
      raise <<-MSG.squish
        Decidim requires the pg_trgm extension to be enabled in your PostgreSQL.
        You can do so by running `CREATE EXTENSION IF NOT EXISTS "pg_trgm";` on the current DB as a PostgreSQL
        super user.
      MSG
    end
  end
end