Merge pull request #1415 from okriuchykhin/ok_SCI_2864

Use built-in methods for Postgres extensions enabling [SCI-2864]
This commit is contained in:
Alex Kriuchykhin 2018-12-16 19:45:56 +01:00 committed by GitHub
commit ab0924c8e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 28 deletions

View file

@ -6,6 +6,8 @@ RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && \
apt-get update -qq && \
apt-get install -y \
nodejs \
groff-base \
awscli \
postgresql-client \
netcat \
default-jre-headless \

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