Module: DynamicMigrations::Postgres::Generator::Extension
- Included in:
- DynamicMigrations::Postgres::Generator
- Defined in:
- lib/dynamic_migrations/postgres/generator/extension.rb
Instance Method Summary collapse
- #disable_extension(extension_name, code_comment = nil) ⇒ Object
- #enable_extension(extension_name, code_comment = nil) ⇒ Object
Instance Method Details
#disable_extension(extension_name, code_comment = nil) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/dynamic_migrations/postgres/generator/extension.rb', line 17 def disable_extension extension_name, code_comment = nil # no table or schema name for this fragment (it is executed at the database level) add_fragment migration_method: :disable_extension, # some extensions have hyphens in them, so coerce the name to underscores # because the object name is used in the migration class name object: extension_name.to_s.tr("-", "_").to_sym, code_comment: code_comment, migration: <<~RUBY disable_extension "#{extension_name}" RUBY end |
#enable_extension(extension_name, code_comment = nil) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/dynamic_migrations/postgres/generator/extension.rb', line 5 def enable_extension extension_name, code_comment = nil # no table or schema name for this fragment (it is executed at the database level) add_fragment migration_method: :enable_extension, # some extensions have hyphens in them, so coerce the name to underscores # because the object name is used in the migration class name object: extension_name.to_s.tr("-", "_").to_sym, code_comment: code_comment, migration: <<~RUBY enable_extension "#{extension_name}" RUBY end |