- 22 9月, 2020 3 次提交
-
-
由 eileencodes 提交于
These weren't consistent. In some errors we were using backticks and others we weren't. This fixes `connected_to` errors to use backticks around the method name
-
由 eileencodes 提交于
These weren't consistent. In some errors we were using backticks and others we weren't. This fixes `connects_to` errors to use backticks around the method name
-
由 eileencodes 提交于
Adds a note to clarify that `while_preventing_writes` is not meant to be a replacement for a readonly replica user. Closes #39132 and #39133 Co-authored-by: NEike Send <eike.send@gmail.com>
-
- 21 9月, 2020 2 次提交
-
-
由 jasl 提交于
-
由 Sampson Crowley 提交于
-
- 18 9月, 2020 1 次提交
-
-
由 Rafael Mendonça França 提交于
The instance and predicate methods are used by Rails so there is no need to generate them.
-
- 17 9月, 2020 2 次提交
-
-
由 eileencodes 提交于
In #40241 I forgot to fix the method's documentation. This commit fixes the docs to match the new, unreleased behavior.
-
由 eileencodes 提交于
While working on some more indepth changes to Rails internal connection management we noticed that it's confusing in some cases that the `role` is implcit when using a `shard`. For example, if you passed a `shard` and not a `role` in an un-nested block the default `role` would be `writing`. ``` ActiveRecord::Base.connected_to(shard: :one) do # connected to writing end ``` However in cases where nesting is used it could be confusing to application authors that the role is inherited: ``` ActiveRecord::Base.connected_to(role: :reading) do ActiveRecord::Base.connected_to(shard: :one) do # will read from shard one replica, not write to primary end end ``` Since this could be potentially confusing, and extremely hard to track in complex applications, the best approach is to require `role` when using `shard` which is what this PR does. Note: the code for this method is...getting unweildy. Once the `database` argument is fully deprecated we can remove most of the guards and make `role` required by removing `nil` from the keyword argument. Until then we need to support required arguments in this round about way.
-
- 16 9月, 2020 2 次提交
-
-
由 Akira Matsuda 提交于
-
由 Ryuta Kamizono 提交于
https://github.com/rails/rails/commit/895134bcff294b05d6f6ebb101f60e3083ec5461#diff-7789e18ec0a61c6845755a257e6eb34fR3 https://github.com/rails/rails/commit/ee9e308f686ac1c7b0714671a1dcf1d96de87d70#diff-5e9551294914b338d923032fa904c6beR103 https://github.com/rails/rails/commit/5f63c771f7ce751fefd000470bf4ccab421988d7#diff-600d5368b55e46ed961abb4295977ac3R506 https://github.com/rails/rails/commit/48b6bacbc534d4be3fa89bc19ea83c357a20e598#diff-279ac5c088a3ee7e9f954bbc10d1b773R246 https://github.com/rails/rails/commit/49adb7f4c61de8cbb02c4a207dbd56093d99e795#diff-0cbe7171fdd7821fd5836896849141c0R111 https://github.com/rails/rails/commit/9bfe89e68ee61d9c8ed71ac98c783a7e47bdb608#diff-9c1c95b001e3680ba8a473cf23508b68R8 https://github.com/rails/rails/commit/a0f18e60900fc45eb3524ab3cdfe57be430d6016#diff-bef0ae2c16dacf77bfd2ba099af8a330R47 https://github.com/rails/rails/commit/8b4d344815655027d9f7584c0a59271dce8f1d5a#diff-09660f59aee7ec893ad609315e8843c5R18 https://github.com/rails/rails/commit/49d1b5a98dc50ca59bbfb817f90eb5c2c2645d30#diff-531e71a9d5fdc8181f38ce4416553694R107 https://github.com/rails/rails/commit/b674f04756e2e23fc18308319e4de8ff562575f4#diff-7521c0bb452244663b689e77658e63e3R98 https://github.com/rails/rails/commit/a9012af6883284a35bc5e6166507d429fe10482d#diff-60bdcf1e1954ec56d41fc4c7bd8d3e39R512 https://github.com/rails/rails/commit/6380aee182a6acb4f5062c5aa377d290e696e4b7#diff-5158c234d5e19bb1cffadcbc088400f1R262 https://github.com/rails/rails/commit/c7820d8124c854760a4d288334f185de2fb99446#diff-f4614e7ba8081c0c9e20fe64b6374228R60 https://github.com/rails/rails/commit/8df7ed3b88fc9f19446d7207a745a331893b81cd#diff-0495ed68f82d1bbde593ab5491eab24aR169 https://github.com/rails/rails/commit/6f94260ac67755fbc4d89e7dd9ba6be04abfa9e7#diff-7ecb6672f3fd37dfb79c4539395d3857R28 https://github.com/rails/rails/commit/03e44f93001db97953917e0a100c627e189e2be6#diff-e9234c4c6668852448059c0a35840bcaR185
-
- 15 9月, 2020 4 次提交
-
-
由 Jason Schweier 提交于
Co-Authored-By: NBob Whitelock <bob.whitelock1@gmail.com> Co-Authored-By: NRafael França <rafael@franca.dev> Co-Authored-By: NKapilSachdev <kapilsachdev03@gmail.com>
-
由 Daniel Colson 提交于
`IPAddr#prefix` was added in https://github.com/ruby/ipaddr/commit/293ad5ac6ed704f91d418ecaf24ae58156a5 and imported into Ruby 2.5 in https://github.com/ruby/ruby/commit/c2db917b3db09e3738529d5a45315b77d12ae4c3 Since Rails now uses Ruby >= 2.5 we can safely rely on `IPAddr#prefix` instead of reaching into instance variables.
-
由 Ryuta Kamizono 提交于
-
由 Akira Matsuda 提交于
-
- 14 9月, 2020 2 次提交
-
-
由 eileencodes 提交于
`connectes_to` should only be called on `ActiveRecord::Base` or abstract classes. This is recommended in the documentation but until now was not enforced by the code. It's unsafe to open too many connections to mysql (and probably other databases), so it's safest to have 1 class for the connection and subclass from that. Co-authored-by: NJohn Crepezzi <john.crepezzi@gmail.com>
-
由 Ryuta Kamizono 提交于
This reverts commit 55d9e494, reversing changes made to 03e987cd. Legacy mysql adapter is already removed in #22642.
-
- 10 9月, 2020 2 次提交
-
-
由 Jean Boussier 提交于
-
由 Jean Boussier 提交于
Revert "Revert "Raise ConnectionNotEstablished rather than StatementInvalid in Mysql2Adapter#quote_string"" This reverts commit 6f92c40d.
-
- 09 9月, 2020 3 次提交
-
-
由 Ryuta Kamizono 提交于
-
https://github.com/rails/rails/pull/40178#issuecomment-688222844由 Ryuta Kamizono 提交于
It is a common use case especially for MySQL users.
-
由 KapilSachdev 提交于
This reverts commit b8ab1f89, reversing changes made to 73ae5655.
-
- 08 9月, 2020 3 次提交
-
-
由 Kevin Deisz 提交于
If you're using the `nulls_first` or `nulls_last` functionality with an explicit ordering, then previously it wasn't properly handling calls to `#reverse` (called through `reverse_order`). This commit changes the behavior to match what would be expected.
-
由 Eugene Kenny 提交于
These methods are PostgreSQL-specific, and all supported versions of PostgreSQL support validating constraints.
-
由 Alex Robbin 提交于
Active Record already supports adding `NOT VALID` foreign key constraints in PostgreSQL, but back in #31323 when check constraint support was initially added, the ability to add a check constraint and validate it separately was not included. This adds that functionality!
-
- 07 9月, 2020 1 次提交
-
-
由 Muhammad Usman 提交于
Closes #40187.
-
- 04 9月, 2020 4 次提交
-
-
由 Guo Xiang Tan 提交于
This prevents the `from` query method from being ignored silently in the resulting SQL query that is generated.
-
由 Josh Goodall 提交于
The current behaviour of reverse_order, when presented with an existing order that is an Arel expression, is to ignore it. This isn't quite in keeping with how it handles Arel attributes (which it reverse) or arbitrary strings (which throw an exception). The easy path would be to throw an exception, but we don't have to. Any SQL expression that is a valid default sort expression can be reversed with DESC. It follows that if there's an existing Arel::Nodes::NodeExpression that is not already wrapped with an Arel::Nodes::Ordering, then it can be reversed with DESC.
-
由 Guo Xiang Tan 提交于
When ActiveRecord is used with Rails, loading `ActiveRecord` will set the configurations so there is no need to do it twice.
-
由 eileencodes 提交于
The handling for single database applications has always set a schema.rb or structure.sql files for loading the database schema. When we first implemented multiple database support we intended to keep this for the original, default database. Afterall Rails _has_ to connect to something on boot. In development only one connection is connected on boot since we don't eager load the app. Originally we had thought that all applications should be required to add a `primary` entry in the database configurations file. However, this hasn't worked in practice and we have some code now that does not assume there's a primary. The schema dumping/loading code however, still assumed there was a "primary" in the configurations file. We want the "default" database in any application to use the original files even when converted to a multiple database application as this reduces the need to make changes when implementing this functionality on an existing application. The changes here update Rails to ensure that we treat either "primary" or the first database configuration for an environment as "default". If there is a "primary" that will be used as the default configuration. If there is no primary the configuration that is first for an environment will be used as the default. For schema dump/load this means that the default configuration (primary or first) will use `schema.rb` as the filename and other configurations will use `[CONFIGURATION_NAME]_schema.rb`. This should also help us finish the pull request to infer migrations paths since now we can say the first configuration is the default. This is a natural assumption for application developers. Followup to #39536
-
- 02 9月, 2020 2 次提交
-
-
由 Ryuta Kamizono 提交于
This reverts commit 55d9e494, reversing changes made to 03e987cd. Legacy mysql adapter is already removed in #22642.
-
由 Ryuta Kamizono 提交于
-
- 01 9月, 2020 5 次提交
-
-
由 Ryuta Kamizono 提交于
-
由 Jean Boussier 提交于
-
由 Jean Boussier 提交于
-
由 Ryuta Kamizono 提交于
Don't call `arel_table[attr]` directly makes handling predicate building easier in 3rd party code.
-
由 Ryuta Kamizono 提交于
Originally, time object is decorated after `changes_applied` by `forgetting_assignment` (`value_for_database`). https://github.com/rails/rails/blob/d2cdf0be675b44771f950697fc0b19ef0ea453f9/activemodel/lib/active_model/attribute.rb#L67-L69 https://github.com/rails/rails/blob/d2cdf0be675b44771f950697fc0b19ef0ea453f9/activemodel/lib/active_model/attribute.rb#L55-L57 Before #36352, fortunately `apply_seconds_precision` will return undecorated new time object by everytime `value.change` is called. Now, we need to explicitly check a time value is decorated or not in `cast_value`. Fixes #36910.
-
- 27 8月, 2020 1 次提交
-
-
由 Rafael Mendonça França 提交于
-
- 26 8月, 2020 3 次提交
-
-
由 Jean Boussier 提交于
-
由 Jean Boussier 提交于
-
由 Guo Xiang Tan 提交于
-