aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/commands/dbconsole
Commit message (Collapse)AuthorAgeFilesLines
* Rename `connection` option to `database` in `dbconsole` commandyuuji.yaginuma2019-04-021-7/+19
| | | | | | | | | | | | | | | We introduced `connection` option for specifying spec with 1acd9a6464668d4d54ab30d016829f60b70dbbeb. But now we are using the `database` to specify the same value in other commands. * https://github.com/rails/rails/blob/0a0f115031b64b5335fa88543c40df4194dfb428/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb#L11 * https://github.com/rails/rails/blob/0a0f115031b64b5335fa88543c40df4194dfb428/activerecord/lib/rails/generators/active_record/model/model_generator.rb#L17 The options provided to the users should be uniform. Since the term "database" is used in rake task etc, So I want to be able to use it in `dbconsole` command. Also I deprecated the `connection` option because I think that it would be confusing if there are multiple options to specify a same value.
* Enable `Performance/UnfreezeString` copyuuji.yaginuma2018-09-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Ruby 2.3 or later, `String#+@` is available and `+@` is faster than `dup`. ```ruby # frozen_string_literal: true require "bundler/inline" gemfile(true) do source "https://rubygems.org" gem "benchmark-ips" end Benchmark.ips do |x| x.report('+@') { +"" } x.report('dup') { "".dup } x.compare! end ``` ``` $ ruby -v benchmark.rb ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] Warming up -------------------------------------- +@ 282.289k i/100ms dup 187.638k i/100ms Calculating ------------------------------------- +@ 6.775M (± 3.6%) i/s - 33.875M in 5.006253s dup 3.320M (± 2.2%) i/s - 16.700M in 5.032125s Comparison: +@: 6775299.3 i/s dup: 3320400.7 i/s - 2.04x slower ```
* Switch dbconsole config loader checkeileencodes2018-03-161-1/+1
| | | | | | | | | | | | In a three-tier config environment `configurations[environment].presence` will return `{ :primary => { :key => value, :key => value }, :secondary => { :key => value, :key => value} }, which means it's not given a single config to connect to. If we flip these however it will connect to primary because that's the default connection, and on a two tier it will be `nil` so the code will select the connection from the configurations rather than the connection.
* [Railties] require_relative => requireAkira Matsuda2017-10-211-1/+1
| | | | This basically reverts 618268b4b9382f4bcf004a945fe2d85c0bd03e32
* Fix `can't modify frozen String` error in `DBConsole`yuuji.yaginuma2017-08-291-1/+1
| | | | | | | | | Without this, `dbconsole` raises an error as follwing: ``` RuntimeError: can't modify frozen String railties/lib/rails/commands/dbconsole/dbconsole_command.rb:79:in `start' ```
* Adding frozen_string_literal pragma to Railties.Pat Allan2017-08-141-0/+2
|
* Railties updates for frozen string literals.Pat Allan2017-08-141-1/+1
|
* Set `RAILS_ENV` before load application fileyuuji.yaginuma2017-07-171-1/+4
| | | | | | | Since #29725, load application file when `dbconsole` command is executed. However, if do not set `RAILS_ENV` before reading the application file, can not connect to the env specified in option, so added the setting of `RAILS_ENV`.
* Properly expand the environment's nameRobin Dupret2017-07-161-3/+0
| | | | | | | | | Running the `console` and `dbconsole` commands with a regular argument as the environment's name automatically expand it to match an existing environment (e.g. dev for development). This feature wasn't available using the `--environment` (a.k.a `-e`) option.
* Allow to pass a connection to the `dbconsole` commandRobin Dupret2017-07-161-2/+14
| | | | | | | | | | | Since 0a4f6009, it's possible to specify a 3-level database configuration to gather connections by environment. The `dbconsole` command will try to look for a database configuration which points to the current environment but with such flavour, the environment key is flushed out so let's add the ability to specify the connection and pick `primary` by default to be consistent with Active Record.
* Load environment file in `dbconsole` commandyuuji.yaginuma2017-07-091-0/+1
| | | | | | | | | Currently the environment file is not loaded in `dbconsole` command. Therefore, for example, if use encrypted secrets values in database.yml, `read_encrypted_secrets` will not be true, so the value can not be used correctly. Fixes #29717
* [Railties] require => require_relativeAkira Matsuda2017-07-011-1/+1
|
* Use appropriate type to `header` optionyuuji.yaginuma2017-04-051-1/+1
| | | | | The `header` option checks only whether it is specified or not. https://github.com/rails/rails/blob/e8c33349bfabca28996ac74d344d69c7aaffec50/railties/lib/rails/commands/dbconsole/dbconsole_command.rb#L52
* Privatize unneededly protected methods in RailtiesAkira Matsuda2016-12-251-3/+3
|
* remove unused requireyuuji.yaginuma2016-11-051-3/+0
| | | | YAML and ERB were removed at 971d510
* Hide commands from API site.Kasper Timm Hansen2016-10-281-1/+1
| | | | | They're just barren on the site and confure more than guide, instead rely on the built in --help to guide users.
* Fix dbconsole tests.Kasper Timm Hansen2016-09-251-6/+4
|
* Initial command structure.Kasper Timm Hansen2016-09-251-0/+160