Module: Glueby::Generator::MigrateGenerator
- Included in:
- Contract::BlockSyncerGenerator, Contract::TimestampGenerator, Contract::TokenGenerator, Contract::WalletAdapterGenerator
- Defined in:
- lib/glueby/generator/migrate_generator.rb
Defined Under Namespace
Modules: ClassMethod
Constant Summary collapse
- MYSQL_ADAPTERS =
[ "ActiveRecord::ConnectionAdapters::MysqlAdapter", "ActiveRecord::ConnectionAdapters::Mysql2Adapter" ].freeze
Instance Method Summary collapse
Instance Method Details
#migration_version ⇒ Object
18 19 20 21 22 23 |
# File 'lib/glueby/generator/migrate_generator.rb', line 18 def migration_version major = ::Rails::VERSION::MAJOR if major >= 5 "[#{major}.#{::Rails::VERSION::MINOR}]" end end |
#mysql? ⇒ Boolean
25 26 27 |
# File 'lib/glueby/generator/migrate_generator.rb', line 25 def mysql? MYSQL_ADAPTERS.include?(::ActiveRecord::Base.connection.class.name) end |
#table_options ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/glueby/generator/migrate_generator.rb', line 29 def if mysql? ', :options => "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci"' else "" end end |