Class: StrongMigrations::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- StrongMigrations::Generators::InstallGenerator
- Defined in:
- lib/generators/strong_migrations/install_generator.rb
Instance Method Summary collapse
- #adapter ⇒ Object
- #create_initializer ⇒ Object
- #pgbouncer_message ⇒ Object
- #postgresql? ⇒ Boolean
- #start_after ⇒ Object
- #target_version ⇒ Object
Instance Method Details
#adapter ⇒ Object
33 34 35 |
# File 'lib/generators/strong_migrations/install_generator.rb', line 33 def adapter ActiveRecord::Base.connection_db_config.adapter.to_s end |
#create_initializer ⇒ Object
8 9 10 |
# File 'lib/generators/strong_migrations/install_generator.rb', line 8 def create_initializer template "initializer.rb", "config/initializers/strong_migrations.rb" end |
#pgbouncer_message ⇒ Object
16 17 18 19 20 |
# File 'lib/generators/strong_migrations/install_generator.rb', line 16 def if postgresql? "\n# If you use PgBouncer in transaction mode, delete these lines and set timeouts on the database user" end end |
#postgresql? ⇒ Boolean
37 38 39 |
# File 'lib/generators/strong_migrations/install_generator.rb', line 37 def postgresql? adapter =~ /postg/ end |
#start_after ⇒ Object
12 13 14 |
# File 'lib/generators/strong_migrations/install_generator.rb', line 12 def start_after Time.now.utc.strftime("%Y%m%d%H%M%S") end |
#target_version ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/generators/strong_migrations/install_generator.rb', line 22 def target_version case adapter when /mysql|trilogy/ # could try to connect to database and check for MariaDB # but this should be fine "8.0" else "10" end end |