title: Cannot run migrations when postgres extension added in rails 5 application
body: <p>I want to use pg_trgm extension of Postgres for searching using query</p>
  
  <pre><code>SELECT * FROM USERS WHERE location like '%new%' ORDER BY location DESC;
  </code></pre>
  
  <p>Since Postgres already don't have pg_trgm I need to execute a command to install it. So my migration to do so is</p>
  
  <pre><code>class Addtrigramindexlocationtousers &lt; ActiveRecord::Migration[5.1]
    def change
      reversible do |direction|
          direction.up {
              execute %{
                  CREATE EXTENSION IF NOT EXISTS pg_trgm;
                  CREATE INDEX index_users_trigram_on_location ON users USING gin (location gin_trgm_ops);
              }
          }
          direction.down {
              execute %{
                  DROP INDEX index_users_trigram_on_location;
              }           
          }
      end
    end
  end
  </code></pre>
  
  <p>So when I run this migration it is giving me this error:</p>
  
  <pre><code>    ActiveRecord::StatementInvalid: PG::InsufficientPrivilege: ERROR:  permission denied to create extension "pg_trgm"
  HINT:  Must be superuser to create this extension.
  : 
                  DROP INDEX index_users_on_location;
                  CREATE EXTENSION IF NOT EXISTS pg_trgm;
                  CREATE INDEX index_users_trigram_on_location ON users USING gin (location gin_trgm_ops);
  </code></pre>
  
  <p>This works if I manually enter to database and execute the command but I need to run it from migration. </p>