Module: Rails::Generators::Database
- Included in:
- AppBase, Rails::Generators::Db::System::ChangeGenerator
- Defined in:
- railties/lib/rails/generators/database.rb
Overview
:nodoc:
Constant Summary collapse
- JDBC_DATABASES =
%w( jdbcmysql jdbcsqlite3 jdbcpostgresql jdbc )
- DATABASES =
%w( mysql postgresql sqlite3 oracle frontbase ibm_db sqlserver ) + JDBC_DATABASES
Instance Method Summary collapse
- #convert_database_option_for_jruby ⇒ Object
- #gem_for_database(database = options[:database]) ⇒ Object
- #initialize ⇒ Object
Instance Method Details
#convert_database_option_for_jruby ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'railties/lib/rails/generators/database.rb', line 30 def convert_database_option_for_jruby if defined?(JRUBY_VERSION) opt = .dup case opt[:database] when "postgresql" then opt[:database] = "jdbcpostgresql" when "mysql" then opt[:database] = "jdbcmysql" when "sqlite3" then opt[:database] = "jdbcsqlite3" end self. = opt.freeze end end |
#gem_for_database(database = options[:database]) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'railties/lib/rails/generators/database.rb', line 14 def gem_for_database(database = [:database]) case database when "mysql" then ["mysql2", ["~> 0.5"]] when "postgresql" then ["pg", [">= 0.18", "< 2.0"]] when "sqlite3" then ["sqlite3", ["~> 1.4"]] when "oracle" then ["activerecord-oracle_enhanced-adapter", nil] when "frontbase" then ["ruby-frontbase", nil] when "sqlserver" then ["activerecord-sqlserver-adapter", nil] when "jdbcmysql" then ["activerecord-jdbcmysql-adapter", nil] when "jdbcsqlite3" then ["activerecord-jdbcsqlite3-adapter", nil] when "jdbcpostgresql" then ["activerecord-jdbcpostgresql-adapter", nil] when "jdbc" then ["activerecord-jdbc-adapter", nil] else [database, nil] end end |
#initialize ⇒ Object
9 10 11 12 |
# File 'railties/lib/rails/generators/database.rb', line 9 def initialize(*) super convert_database_option_for_jruby end |