mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-27 18:21:50 +08:00
Merge pull request #1415 from okriuchykhin/ok_SCI_2864
Use built-in methods for Postgres extensions enabling [SCI-2864]
This commit is contained in:
commit
ab0924c8e6
4 changed files with 4 additions and 28 deletions
|
@ -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 \
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue