Created
October 27, 2016 12:45
-
-
Save yoshuki/3f42cb18498dc3509b36a6472f1b3272 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EnablePGroonga < ActiveRecord::Migration | |
def change | |
reversible do |r| | |
current_database = select_value('SELECT current_database()') | |
r.up do | |
enable_extension('pgroonga') | |
execute("ALTER DATABASE #{current_database} SET search_path = '$user',public,pgroonga,pg_catalog;") | |
end | |
r.down do | |
execute("ALTER DATABASE #{current_database} RESET search_path;") | |
disable_extension('pgroonga') | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment