| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
Rails 6 requires Ruby 2.5, which introduces `FrozenError`
https://docs.ruby-lang.org/en/2.5.0/NEWS.html
Related to #31520
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a transaction is opened and closed without any queries being run, we
can safely omit the `BEGIN` and `COMMIT` statements, as they only exist
to modify the connection's behaviour inside the transaction. This
removes the overhead of those statements when saving a record with no
changes, which makes workarounds like `save if changed?` unnecessary.
This implementation buffers transactions inside the transaction manager
and materializes them the next time the connection is used. For this to
work, the adapter needs to guard all connection use with a call to
`materialize_transactions`. Because of this, adapters must opt in to get
this new behaviour by implementing `supports_lazy_transactions?`.
If `raw_connection` is used to get a reference to the underlying
database connection, the behaviour is disabled and transactions are
opened eagerly, as we can't know how the connection will be used.
However when the connection is checked back into the pool, we can assume
that the application won't use the reference again and reenable lazy
transactions. This prevents a single `raw_connection` call from
disabling lazy transactions for the lifetime of the connection.
|
|
|
|
|
|
|
| |
It will cause "undefined method `test_order' for ActiveSupport:Module
(NoMethodError)".
https://travis-ci.org/rails/rails/jobs/373472604#L1208
|
|\
| |
| | |
Add bulk alter support for PostgreSQL
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This pull request handles `FrozenError` introduced by Ruby 2.5.
Refer https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/61131
Since `FrozenError` is a subclass of `RuntimeError` minitest used by master
branch can handle it, though it would be better to handle `FrozenError`
explicitly if possible.
`FrozenError` does not exist in Ruby 2.4 or lower, `frozen_error_class`
handles which exception is expected to be raised.
This pull request is intended to be merged to master,
then backported to `5-1-stable` to address #31508
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This pull request addresses these 17 failures when tested with Oracle enhanced adapter.
All of these failures are due to the incorrect number of queries. Here is the first one.
```ruby
$ ARCONN=oracle bin/test test/cases/nested_attributes_test.rb:1086
Using oracle
Run options: --seed 27985
F
Finished in 0.874514s, 1.1435 runs/s, 1.1435 assertions/s.
1) Failure:
TestHasManyAutosaveAssociationWhichItselfHasAutosaveAssociations#test_circular_references_do_not_perform_unnecessary_queries [/home/yahonda/git/rails/activerecord/test/cases/nested_attributes_test.rb:1086]:
6 instead of 3 queries were executed.
Queries:
select us.sequence_name from all_sequences us where us.sequence_owner = :owner and us.sequence_name = :sequence_name
INSERT INTO "SHIPS" ("NAME", "ID") VALUES (:a1, :a2)
select us.sequence_name from all_sequences us where us.sequence_owner = :owner and us.sequence_name = :sequence_name
INSERT INTO "SHIP_PARTS" ("NAME", "SHIP_ID", "UPDATED_AT", "ID") VALUES (:a1, :a2, :a3, :a4)
select us.sequence_name from all_sequences us where us.sequence_owner = :owner and us.sequence_name = :sequence_name
INSERT INTO "TREASURES" ("LOOTER_ID", "LOOTER_TYPE", "SHIP_ID", "ID") VALUES (:a1, :a2, :a3, :a4).
Expected: 3
Actual: 6
1 runs, 1 assertions, 1 failures, 0 errors, 0 skips
$
```
Since https://github.com/rsim/oracle-enhanced/pull/1490 Oracle enhanced adapter drops its own schema caching called OracleEnhancedAdapter.cache_columns` to use Rails scehema cache
generated by `db:schema:cache:dump`.
By this change some extra sql statements executed at ActiveRecord unit test, which can be
fixed by adding the sql statement to `oracle_ignored`.
* All 17 failures fixed by this pull request:
```ruby
ARCONN=oracle bin/test test/cases/nested_attributes_test.rb:1086
ARCONN=oracle bin/test test/cases/locking_test.rb:308
ARCONN=oracle bin/test test/cases/locking_test.rb:365
ARCONN=oracle bin/test test/cases/dirty_test.rb:351
ARCONN=oracle bin/test test/cases/dirty_test.rb:334
ARCONN=oracle bin/test test/cases/autosave_association_test.rb:192
ARCONN=oracle bin/test test/cases/associations/has_many_associations_test.rb:950
ARCONN=oracle bin/test test/cases/associations/has_many_associations_test.rb:1059
ARCONN=oracle bin/test test/cases/autosave_association_test.rb:627
ARCONN=oracle bin/test test/cases/autosave_association_test.rb:607
ARCONN=oracle bin/test test/cases/autosave_association_test.rb:617
ARCONN=oracle bin/test test/cases/autosave_association_test.rb:641
ARCONN=oracle bin/test test/cases/associations/has_many_through_associations_test.rb:546
ARCONN=oracle bin/test test/cases/associations/has_many_through_associations_test.rb:297
ARCONN=oracle bin/test test/cases/associations/has_many_through_associations_test.rb:586
ARCONN=oracle bin/test test/cases/associations/has_many_through_associations_test.rb:172
ARCONN=oracle bin/test test/cases/associations/has_many_through_associations_test.rb:269
```
|
|\
| |
| | |
Use frozen-string-literal in ActiveRecord
|
| | |
|
|/
|
|
|
|
|
|
| |
This reverts commit b6ad4052d18e4b29b8a092526c2beef013e2bf4f.
This is not something that the majority of Active Record should be
testing or care about. We should look at having fewer places rely on
these details, not make it easier to rely on them.
|
|
|
|
|
| |
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
|
| |
|
|
|
|
| |
These are used in tests from anywhere.
|
| |
|
|
|
|
|
|
| |
Regexp#match? should be considered to be part of the Ruby core library. We are
emulating it for < 2.4, but not having to require the extension is part of the
illusion of the emulation.
|
| |
|
|
|
|
|
|
|
|
| |
Style/SpaceBeforeBlockBraces
Style/SpaceInsideBlockBraces
Style/SpaceInsideHashLiteralBraces
Fix all violations in the repository.
|
|
|
|
| |
test cases
|
|
|
|
|
|
|
|
|
| |
A few have been left for aesthetic reasons, but have made a pass
and removed most of them.
Note that if the method `foo` returns an array, `foo << 1`
is a regular push, nothing to do with assignments, so
no self required.
|
|
|
|
|
| |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
| |
|
|
|
|
|
| |
Where appropriatei, prefer the more concise Regexp#match?,
String#include?, String#start_with?, or String#end_with?
|
|
|
|
|
|
| |
`assert_date_from_db` was added at 6a2104d for SQL Server.
But latest sqlserver adapter work to pass expected behavior since
8e4624b.
|
| |
|
|
|
|
|
|
| |
This issue was resolved by #21687 already. But re-add args by #18856.
`#tables` extra args was only using by `#table_exists?`. This is for
internal API. This commit will remove these extra args again.
|
|
|
|
|
| |
I messed up the merge conflict, and accidentally removed a schema query
that needed to be ignored.
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
The `SHOW TABLES LIKE` command accepts metacharacters `%` and `_` in
potentially unexpected ways. This can be avoided by querying `information_schema.tables`
directly.
Fixes #17897
|
| |
| |
| |
| |
| |
| | |
`table_exists?` calls `tables` twice when passed `'dbname.tblname'` arg.
This change is that `table_exists?` execute only once query always and
extra args of `tables` is removed.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Example:
create_table :barcodes, primary_key: ["region", "code"] do |t|
t.string :region
t.integer :code
end
|
| | |
|
|/ |
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Added include for the same in ActiveSupport::Test.
- Removed occurrences of silence_stream being used elsewhere.
- Reordered activesupport testcase requires alphabetically.
- Removed require of silence stream from test_case
- Moved quietly method to stream helper
- Moved capture output to stream helper module and setup requires for the same elsewhere
|
| |
|
| |
|
| |
|
|
|
|
| |
This is a follow up to f8f5cdc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a follow-up to 3121412
/cc @rafaelfranca
This will remove deprecation warnings from the PostgreSQL suite:
```
DEPRECATION WARNING: #capture(stream) is deprecated and will be removed in the next release. (called from capture at /Users/senny/Projects/rails/activesupport/lib/active_support/core_ext/kernel/reporting.rb:89)
/Users/senny/Projects/rails/activesupport/lib/active_support/core_ext/kernel/reporting.rb:89:in `capture'
/Users/senny/Projects/rails/activerecord/test/cases/adapters/postgresql/composite_test.rb:73:in `ensure_warning_is_issued'
/Users/senny/Projects/rails/activerecord/test/cases/adapters/postgresql/composite_test.rb:48:in `test_column'
/Users/senny/Projects/rails/.bundle/gems/minitest-5.3.3/lib/minitest/test.rb:106:in `block (3 levels) in run'
/Users/senny/Projects/rails/.bundle/gems/minitest-5.3.3/lib/minitest/test.rb:204:in `capture_exceptions'
/Users/senny/Projects/rails/.bundle/gems/minitest-5.3.3/lib/minitest/test.rb:103:in `block (2 levels) in run'
/Users/senny/Projects/rails/.bundle/gems/minitest-5.3.3/lib/minitest/test.rb:256:in `time_it'
/Users/senny/Projects/rails/.bundle/gems/minitest-5.3.3/lib/minitest/test.rb:102:in `block in run'
/Users/senny/Projects/rails/.bundle/gems/minitest-5.3.3/lib/minitest.rb:317:in `on_signal'
/Users/senny/Projects/rails/.bundle/gems/minitest-5.3.3/lib/minitest/test.rb:276:in `with_info_handler'
/Users/senny/Projects/rails/.bundle/gems/minitest-5.3.3/lib/minitest/test.rb:101:in `run'
/Users/senny/Projects/rails/.bundle/gems/minitest-5.3.3/lib/minitest.rb:759:in `run_one_method'
/Users/senny/Projects/rails/.bundle/gems/minitest-5.3.3/lib/minitest.rb:293:in `run_one_method'
/Users/senny/Projects/rails/.bundle/gems/minitest-5.3.3/lib/minitest.rb:287:in `block (2 levels) in run'
/Users/senny/Projects/rails/.bundle/gems/minitest-5.3.3/lib/minitest.rb:286:in `each'
/Users/senny/Projects/rails/.bundle/gems/minitest-5.3.3/lib/minitest.rb:286:in `block in run'
/Users/senny/Projects/rails/.bundle/gems/minitest-5.3.3/lib/minitest.rb:317:in `on_signal'
/Users/senny/Projects/rails/.bundle/gems/minitest-5.3.3/lib/minitest.rb:306:in `with_info_handler'
/Users/senny/Projects/rails/.bundle/gems/minitest-5.3.3/lib/minitest.rb:285:in `run'
/Users/senny/Projects/rails/.bundle/gems/minitest-5.3.3/lib/minitest.rb:149:in `block in __run'
/Users/senny/Projects/rails/.bundle/gems/minitest-5.3.3/lib/minitest.rb:149:in `map'
/Users/senny/Projects/rails/.bundle/gems/minitest-5.3.3/lib/minitest.rb:149:in `__run'
/Users/senny/Projects/rails/.bundle/gems/minitest-5.3.3/lib/minitest.rb:126:in `run'
/Users/senny/Projects/rails/.bundle/gems/minitest-5.3.3/lib/minitest.rb:55:in `block in autorun'
```
|
| |
|
|
|
|
|
|
|
| |
set assert_sql to reuse the capture_sql method from above
instead of repeating the code
in response to comments on issue #14546
|
|
|
|
|
| |
Other methods compare specific patterns, this method outputs
the actual sql query that is generated.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
/cc @tenderlove
|
| |
|
|
|
|
| |
requires SQLCounter which was moved to AR internal tests only.
|
|
|