class StrongMigrations::Generators::InstallGenerator
Public Instance Methods
adapter()
click to toggle source
# File lib/generators/strong_migrations/install_generator.rb, line 33 def adapter if ActiveRecord::VERSION::STRING.to_f >= 6.1 ActiveRecord::Base.connection_db_config.adapter.to_s else ActiveRecord::Base.connection_config[:adapter].to_s end end
create_initializer()
click to toggle source
# File lib/generators/strong_migrations/install_generator.rb, line 8 def create_initializer template "initializer.rb", "config/initializers/strong_migrations.rb" end
pgbouncer_message()
click to toggle source
# File lib/generators/strong_migrations/install_generator.rb, line 16 def pgbouncer_message if postgresql? "\n# If you use PgBouncer in transaction mode, delete these lines and set timeouts on the database user" end end
postgresql?()
click to toggle source
# File lib/generators/strong_migrations/install_generator.rb, line 41 def postgresql? adapter =~ /postg/ end
start_after()
click to toggle source
# 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()
click to toggle source
# File lib/generators/strong_migrations/install_generator.rb, line 22 def target_version case adapter when /mysql/ # could try to connect to database and check for MariaDB # but this should be fine '"8.0.12"' else "10" end end