Use built-in methods for Postgres extensions enabling [SCI-2864]

This commit is contained in:
Oleksii Kriuchykhin 2018-12-10 14:14:49 +01:00
parent 9621f0b372
commit 7cd1c12a4f
3 changed files with 2 additions and 28 deletions

View file

@ -4,20 +4,6 @@ module DatabaseHelper
ActiveRecord::Base.connection.adapter_name == adapter_name
end
# Create PostgreSQL extension. PostgreSQL only!
def create_extension(ext_name)
ActiveRecord::Base.connection.execute(
"CREATE EXTENSION #{ext_name};"
)
end
# Drop PostgreSQL extension. PostgreSQL only!
def drop_extension(ext_name)
ActiveRecord::Base.connection.execute(
"DROP EXTENSION #{ext_name};"
)
end
# Create gist trigram index. PostgreSQL only!
def add_gist_index(table, column)
ActiveRecord::Base.connection.execute(

View file

@ -4,13 +4,7 @@ include DatabaseHelper
class AddPgTrgmSupport < ActiveRecord::Migration[4.2]
def up
if db_adapter_is? "PostgreSQL" then
create_extension :pg_trgm
end
end
def down
if db_adapter_is? "PostgreSQL" then
drop_extension :pg_trgm
enable_extension :pg_trgm
end
end
end

View file

@ -4,13 +4,7 @@ include DatabaseHelper
class AddBtreeGistExtension < ActiveRecord::Migration[4.2]
def up
if db_adapter_is? "PostgreSQL" then
create_extension :btree_gist
end
end
def down
if db_adapter_is? "PostgreSQL" then
drop_extension :btree_gist
enable_extension :btree_gist
end
end
end