| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
```
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
This basically reverts 618268b4b9382f4bcf004a945fe2d85c0bd03e32
|
|
|
|
|
|
|
|
|
| |
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'
```
|
| |
|
| |
|
|
|
|
|
|
|
| |
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`.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
| |
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
|
| |
|
|
|
|
| |
YAML and ERB were removed at 971d510
|
|
|
|
|
| |
They're just barren on the site and confure more than guide, instead
rely on the built in --help to guide users.
|
| |
|
|
|