| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
https://travis-ci.org/rails/rails/jobs/268599781#L784
|
|\
| |
| | |
Fix broken doc for Active Record [ci skip]
|
| | |
|
| | |
|
|/
|
|
|
|
|
| |
This regression was caused by caa178c1. The block for
`set_inverse_instance` should also be passed to join dependency.
Fixes #30402.
|
|
|
|
|
|
|
| |
when other `AutomaticInverseFindingTests` load `:comments` fixture
but does not load `:posts`.
Refer #30385 for similar issue
|
| |
|
|\
| |
| | |
Refactor `SchemaDumper` to make it possible to adapter specific customization
|
| |
| |
| |
| |
| |
| |
| | |
Currently `SchemaDumper` is only customizable for column options. But
3rd party connection adapters (oracle-enhanced etc) need to customizable
for table or index dumping also. To make it possible, I introduced
adapter specific `SchemaDumper` classes for that.
|
| | |
|
| | |
|
|\ \
| | |
| | | |
`counter_cache` requires association class before `attr_readonly`
|
| |/
| |
| |
| |
| | |
There were similar pull requests #26370 #27575 fixed by different way
by moving `require "models/post"` before `require "models/comment"`
|
|\ \
| | |
| | | |
Load :author_addresses fixture to keep data integrity with :authors
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`:authors` has a foreign key to `:author_addresses`.
If only `:authors` fixture loaded into the database which supports
foreign key and checks the existing data when enabling foreien keys
like Oracle, it raises the following error
`ORA-02298: cannot validate (ARUNIT.FK_RAILS_94423A17A3) - parent keys not found`
It is because there is no parent data exists in `author_addresses` table.
Here are how other database with foreign key support works:
- MySQL does not check the existing data when enabling foreign key by `foreign_key_checks=1`
https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_foreign_key_checks
> Setting foreign_key_checks to 1 does not trigger a scan of the existing table data. Therefore, rows added to the table while foreign_key_checks=0 will not be verified for consistency.
- PostgreSQL database itself has a feature to check existing data when
enabling foreign key and discussed at #27636, which is reverted.
|
|\ \
| |/
|/| |
Add TransactionTimeout for MySQL error code 1205
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
ActiveRecord associations automatically guess the inverse associations.
But this feature does not work correctly on assoctions for STI.
For example, before this commit
```
class Post < ActiveRecord::Base
belongs_to :author
end
class SpecialPost < Post; end
class Author < ActiveRecord::Base
has_many :posts
has_many :special_posts
end
```
`author.posts.first.author` works correctly, but
`author.special_posts.first.author` does not work correctly.
|
|\ \
| | |
| | |
| | |
| | | |
yhirano55/use_https_instead_of_http_in_activerecord
[activerecord] Update links to use https instead of http [ci skip]
|
| |/ |
|
|/ |
|
|
|
|
|
|
|
|
| |
`SET time zone 'value'` is an alias for `SET timezone TO 'value'`.
https://www.postgresql.org/docs/current/static/sql-set.html
So if `variables["timezone"]` is specified, it is enough to
`SET timezone` once.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
This is only used for the internal `column_spec` and
`column_spec_for_primary_key`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
currently integer types extracts the `limit` from `sql_type`. But the
lookup key of type map is the `oid` in postgresql adapter. So in most
case `sql_type` is passed to `extract_limit` as `""` and `limit` is
extracted as `nil`.
https://github.com/rails/rails/blob/v5.1.0.beta1/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L445
In mysql2 adapter, `limit` is registered correctly without extracting
from `sql_type`.
https://github.com/rails/rails/blob/v5.1.0.beta1/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L678-L682
Postgresql adapter should also be registered correctly.
``` ruby
conn = ActiveRecord::Base.connection
conn.select_all("SELECT 1::smallint, 2::integer, 3::bigint").column_types.map do |name, type|
[name, type.limit]
end
```
Before:
``` ruby
# => [["int2", nil], ["int4", nil], ["int8", nil]]
```
After:
``` ruby
# => [["int2", 2], ["int4", 4], ["int8", 8]]
```
|
| |
|
|
|
|
|
| |
* Test `test_unabstracted_database_dependent_types` for `PostgreSQLAdapter`
* Add `test_change_column_with_new_precision_and_scale` for `SQLite3Adapter`
* This test case and comment was lost at 28bb02a78fd47527bb7a208d01a4594bb212812c
|
|
|
|
|
|
| |
Otherwise random CI failure will be caused.
https://travis-ci.org/rails/rails/jobs/265848046#L777
|
|
|
|
|
|
|
|
| |
(#29944)
Since 213796f, it was lost the ability that SQL with binds for `insert`,
`update`, and `delete` (like `select_all`). This restores the ability
because `insert`, `update`, and `delete` are public API, so it should
not be removed without deprecation.
|
|
|
|
|
|
|
| |
affected by scoping (#29997)
I tried to change the expectation in #29976, but it is expected behavior
at least for now. So I added the test cases to prevent anyone change the
expectation.
|
|
|
|
| |
Because `to_sql` is public API. I introduced `to_sql_and_binds` internal
API to return SQL and binds.
|
|
|
|
|
|
|
|
|
|
|
| |
`where.not` with multiple conditions is still unexpected behavior. But
`where.not` with only polymorphic association has already been fixed in
213796fb.
Closes #14161.
Closes #16983.
Closes #17010.
Closes #26207.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`TimestampsWithoutTransactionTest`
This commit addresses these failures when the backend RDBMS executes implicit commit for DDL like MySQL and Oracle.
```ruby
$ ARCONN=mysql2 bin/test test/cases/integration_test.rb test/cases/timestamp_test.rb --seed 58225 -n '/^(?:TimestampTest#(?:test_index_is_created_for_both_timestamps)|IntegrationTest#(?:test_cache_key_for_newer_updated_at|test_cache_key_format_for_existing_record_with_updated_at|test_cache_key_format_for_existing_record_with_updated_at_and_custom_cache_timestamp_format))$/' -v
Using mysql2
Run options: --seed 58225 -n "/^(?:TimestampTest#(?:test_index_is_created_for_both_timestamps)|IntegrationTest#(?:test_cache_key_for_newer_updated_at|test_cache_key_format_for_existing_record_with_updated_at|test_cache_key_format_for_existing_record_with_updated_at_and_custom_cache_timestamp_format))$/" -v
TimestampTest#test_index_is_created_for_both_timestamps = 0.19 s = .
IntegrationTest#test_cache_key_format_for_existing_record_with_updated_at = 0.05 s = F
IntegrationTest#test_cache_key_format_for_existing_record_with_updated_at_and_custom_cache_timestamp_format = 0.02 s = F
IntegrationTest#test_cache_key_for_newer_updated_at = 0.01 s = F
Finished in 0.272880s, 14.6585 runs/s, 14.6585 assertions/s.
1) Failure:
IntegrationTest#test_cache_key_format_for_existing_record_with_updated_at [/home/yahonda/git/rails/activerecord/test/cases/integration_test.rb:111]:
--- expected
+++ actual
@@ -1 +1 @@
-"developers/1-20170717135609430848"
+"developers/1-20170817135609283207"
2) Failure:
IntegrationTest#test_cache_key_format_for_existing_record_with_updated_at_and_custom_cache_timestamp_format [/home/yahonda/git/rails/activerecord/test/cases/integration_test.rb:116]:
--- expected
+++ actual
@@ -1 +1 @@
-"cached_developers/1-20170717135609"
+"cached_developers/1-20170817135609"
3) Failure:
IntegrationTest#test_cache_key_for_newer_updated_at [/home/yahonda/git/rails/activerecord/test/cases/integration_test.rb:147]:
--- expected
+++ actual
@@ -1 +1 @@
-"developers/1-20170717145609430848"
+"developers/1-20170817135609283207"
4 runs, 4 assertions, 3 failures, 0 errors, 0 skips
$
```
`ActiveRecord::TestCase::TimestampTest#test_index_is_created_for_both_timestamps`
calls`ActiveRecord::TestCase::TimestampTest#setup` which updates `updated_at` column value.
```ruby
@developer = Developer.first
... snip ...
@developer.update_columns(updated_at: Time.now.prev_month)
```
This transaction expected to be rolled back, but if the backend RDBMS like MySQL perfomes
implicit commit when DDL executed, this transacion is committed by `create table` statement
inside `ActiveRecord::TestCase::TimestampTest#test_index_is_created_for_both_timestamps`.
It causes these failures above which expect `update_at` column value are not changed(rollbacked).
|
|\
| |
| | |
Allow `table_name_prefix` and `table_name_suffix` have `$`
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
MySQL 5.7 and PostgreSQL 9.6 allow table identifiers have the dollar sign.
* MySQL 5.7
https://dev.mysql.com/doc/refman/5.7/en/identifiers.html
> Permitted characters in unquoted identifiers:
> ASCII: [0-9,a-z,A-Z$_] (basic Latin letters, digits 0-9, dollar, underscore)
* PostgreSQL 9.6
https://www.postgresql.org/docs/9.6/static/sql-syntax-lexical.html
> SQL identifiers and key words must begin with a letter (a-z, but also letters with diacritical marks and non-Latin letters) or an underscore (_). Subsequent characters in an identifier or key word can be letters, underscores, digits (0-9), or dollar signs ($). Note that dollar signs are not allowed in identifiers according to the letter of the SQL standard, so their use might render applications less portable. The SQL standard will not define a key word that contains digits or starts or ends with an underscore, so identifiers of this form are safe against possible conflict with future extensions of the standard.
Address #30044
[Yasuo Honda & Ryuta Kamizono]
|
| |
| |
| |
| | |
[ci skip]
|
|\ \
| | |
| | | |
Fix RuboCop offenses
|
| | |
| | |
| | |
| | | |
And enable `context_dependent` of Style/BracesAroundHashParameters cop.
|
|/ /
| |
| | |
Since c51f9b61 changed the "_before_type_cast" expectation for enum.
|
|\ \
| | |
| | |
| | |
| | | |
kamipo/through_scope_should_not_be_affected_by_scoping
Through scope should not be affected by scoping
|
| | |
| | |
| | |
| | |
| | |
| | | |
Follow up of #29834.
Fixes #30266.
|
|/ /
| |
| |
| |
| |
| | |
`write_attribute_without_type_cast` is defined as a private method in
`AttributeMethods::Write`, but `AttributeMethods::Dirty` overrode it as
a public method. It should be kept the original visibility.
|
| |
| |
| |
| |
| |
| | |
Add missing backticks
Add missing *
Add missing .
|
|\ \
| | |
| | |
| | | |
Ensure sum honors distinct on has_many through
|
| | |
| | |
| | |
| | |
| | |
| | | |
When using a has_many through relation and then summing an attribute
the distinct was not being used. This will ensure that when summing
an attribute, the number is only used once when distinct has been used.
|
|\ \ \
| | | |
| | | | |
Clarify base_class tests on abstract STI vs concrete STI
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
Add `binary` helper method to fixtures.
|