Last active
August 29, 2015 14:18
-
-
Save kubakrzempek/1754d2220f9addbdb49e to your computer and use it in GitHub Desktop.
Rails and postgresql extensions
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
# It doesn't work... | |
class InstallTrigramContribPackage < ActiveRecord::Migration | |
def up | |
execute 'CREATE EXTENSION pg_trgm' | |
end | |
def down | |
execute 'DROP EXTENSION pg_trgm' | |
end | |
end | |
# ... this one does... | |
class InstallTrigramContribPackage < ActiveRecord::Migration | |
def up | |
execute 'CREATE EXTENSION IF NOT EXISTS pg_trgm' | |
end | |
def down | |
execute 'DROP EXTENSION pg_trgm' | |
end | |
end | |
# ... but this looks better | |
class InstallTrigramContribPackage < ActiveRecord::Migration | |
def up | |
enable_extension "pg_trgm" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment