Module: PGSpecHelper::Extensions
- Included in:
- PGSpecHelper
- Defined in:
- lib/pg_spec_helper/extensions.rb
Instance Method Summary collapse
-
#create_extension(extension_name) ⇒ Object
Create an extension.
-
#drop_extension(extension_name) ⇒ Object
Drop an extension.
-
#get_extension_names ⇒ Object
get a list of extension names for the provided table.
Instance Method Details
#create_extension(extension_name) ⇒ Object
Create an extension
6 7 8 9 10 |
# File 'lib/pg_spec_helper/extensions.rb', line 6 def create_extension extension_name connection.exec(<<~SQL) CREATE EXTENSION "#{extension_name}" SQL end |
#drop_extension(extension_name) ⇒ Object
Drop an extension
13 14 15 16 17 |
# File 'lib/pg_spec_helper/extensions.rb', line 13 def drop_extension extension_name connection.exec(<<~SQL) DROP EXTENSION "#{extension_name}" SQL end |
#get_extension_names ⇒ Object
get a list of extension names for the provided table
20 21 22 23 24 25 26 27 |
# File 'lib/pg_spec_helper/extensions.rb', line 20 def get_extension_names rows = connection.exec_params(<<~SQL) SELECT extname AS name FROM pg_extension SQL rows.map { |row| row["name"].to_sym } end |