title: Postgres functions not persisted after db:reset
body: <p>I have created a migration with custom postgres function creation:</p>
  
  <pre><code>class CreatePopularityPgFunctions &lt; ActiveRecord::Migration[5.2]
    def up
      execute %{
        CREATE OR REPLACE FUNCTION popularity(count integer, weight integer default 3) RETURNS integer AS $$
          SELECT count * weight
        $$ LANGUAGE SQL IMMUTABLE;
      }
    end
  
    def down
      execute 'drop function popularity(integer, integer) cascade'
    end
  end
  </code></pre>
  
  <p>and running <code>rake db:migrate</code> properly adds it to the schema. However, running <code>rake db:reset</code> seems to not create this function in PG for some reason. The function is not in the schema and trying to use it in SQL query results in error about missing function.</p>