Commit Graph

15290 Commits

Author SHA1 Message Date
eileencodes
0d8d64e9d0 Add regression test for foreign key schema dump caching
If you had a foreign key set and then decided to add `on_delete:
:cascade` later in another migration that migration would run but
wouldn't refresh the schema dump.

The reason for this was because `create_table_info` caches the statement
and sets it to be the same as the original declaration for the foreign
key (without the `on_delete: :cascade`.

PR #25307 ended up fixing this bug because it removes the check for
`create_table_info` and relies on reading from `information_schema`. The
fix however was intended to patch another bug. The reason this fixes the
issue is we're no longer parsing the regex from the cached
`create_table_info`.

This regression test is to ensure that the issue does not return if we
for some reason go back to using `create_table_info` to set the foreign
keys.
2016-07-01 11:43:46 -04:00
Eileen M. Uchitelle
4abd389ef7 Merge pull request #25307 from kamipo/extract_foreign_key_action_from_information_schema
Extract foreign key action from `information_schema`
2016-07-01 11:30:40 -04:00
Kevin McPhillips
a023fd6657 Do not specal case inspecting associated arrays of over 10 elements, preventing infinite looping in some cases. 2016-06-29 10:31:09 -04:00
Sean Griffin
160cc33179 Don't attempt to clear active connections unless we'ere connected
Right now with this middleware we are likely always connected, but I'm
hoping to change that soon. This is an easy change to pull out on its
own.
2016-06-29 09:56:19 -04:00
Sean Griffin
4565de0da1 Remove unused ActiveRecord::Base.connection_id
This method appears to have been partially used in connection pool
caching, but it was introduced without much reasoning or any tests. One
edge case test was added later on, but it was focused on implementation
details. This method is no longer used outside of tests, and as such is
removed.
2016-06-29 09:50:52 -04:00
Rafael França
a215642828 Merge pull request #25364 from kamipo/fix_serialize_for_date_type
Fix `Type::Date#serialize` to return a date object correctly
2016-06-28 23:33:31 -03:00
Alex Kitchens
d6f0a1a603 [ci skip] Clarify DDL term in ActiveRecord::Transactions 2016-06-27 09:19:36 -05:00
Ryuta Kamizono
59c218ea9b Remove unnecessary assert_valid_default
This was added at c7c3f73 but it never raised because MySQL cannot
create text/blob columns with a default value.
2016-06-25 21:17:27 +09:00
Jon Moss
afd96b6585
nodoc ActiveRecord::AttributeSet::YAMLEncoder
As mentioned in 7b86ea6715ee987e61a7f3bd8e72b1bbfcfbbbe7, this is an
internal class.

[ci skip]

r? @sgrif
2016-06-24 13:15:55 -04:00
Jon Moss
7b86ea6715 Revert "[ci skip] better docs for ActiveRecord::AttributeSet::YAMLEncoder#decode"
This reverts commit 7ea502ae141fc26b736c7a73bdf7a676b1f9fc87, per
internal discussion with @sgrif -- this is documenting the
implementation of a class that isn't intended to be public API.
2016-06-24 12:45:03 -04:00
Sean Griffin
3827049872 Merge pull request #25506 from y-yagi/return_correct_from_enum_type
return correct type from `EnumType`
2016-06-24 06:16:46 -04:00
yuuji.yaginuma
8f290092f0 return correct type from EnumType 2016-06-24 17:43:25 +09:00
Edouard CHIN
3aae8ab6b0 Removed a forgotten with_exclusive_scope test:
- `with_exclusive_scope` was removed in this commit d242e467819a428ad7e302968e4c9fa1e26d9326
2016-06-24 00:30:42 -04:00
Alex Kitchens
415856663d [ci skip] Update Documentation on ActiveRecord::Inheritance 2016-06-23 08:12:17 -05:00
David Elliott
7ea502ae14 [ci skip] better docs for ActiveRecord::AttributeSet::YAMLEncoder#decode 2016-06-21 16:37:52 -04:00
Alex Kitchens
33c78c3787 [ci skip] fix typo in ActiveRecord::ConnectionHandling 2016-06-20 08:49:59 -05:00
Arthur Nogueira Neves
6d4df1d330 Merge pull request #23301 from ppworks/improve_mysqldump
Improve mysqldump
2016-06-17 12:23:50 -04:00
Jon Moss
80e819586b
Move code style configuration files to root directory
I think these are meant to be in the root directory, not in
`/activerecord`? 😬

r? @sgrif

[ci skip]
2016-06-16 22:17:46 -04:00
Arthur Nogueira Neves
267489a103 Merge pull request #24773 from ralinc/fix-silent-fail-on-psql-command
PostgreSQL: Fix db:structure:load silent failure on SQL error
2016-06-16 20:07:27 -04:00
Ryuta Kamizono
10b81fb51a Fix Type::Date#serialize to return a date object correctly
Currently `Type::Date#serialize` does not cast a value to a date object.
It should be cast to a date object for finding by date column correctly
working.

Fixes #25354.
2016-06-16 08:04:16 +09:00
Sean Griffin
7980b31bc6 Merge pull request #25271 from kamipo/prevent_range_error_for_exists
Prevent `RangeError` for `FinderMethods#exists?`
2016-06-15 18:22:34 -04:00
Ryuta Kamizono
1cf467b7a3 Prevent RangeError for FinderMethods#exists?
`FinderMethods#exists?` should return a boolean rather than raising an
exception.

`UniquenessValidator#build_relation` catches a `RangeError` because it
includes type casting due to a string value truncation. But a string
value truncation was removed at #23523 then type casting in
`build_relation` is no longer necessary. aa06231 removes type casting in
`build_relation` then a `RangeError` moves to `relation.exists?`.

This change will remove the catching a `RangeError`.
2016-06-16 06:25:37 +09:00
Rafael França
d4514e3be1 Merge pull request #25339 from prathamesh-sonpatki/reuse-validate-index-length
Reuse validate index length
2016-06-15 15:28:25 -04:00
Arthur Neves
1f63cd9190
Fix postgresql query_cache test 2016-06-14 13:06:30 -04:00
Arthur Neves
009b2a5434
Respect the current connected? method when calling cache
Before we enable query caching we check if the connection is
connected. Before this fix we were always checking against the main
connection, and not the model connection.
2016-06-14 12:37:50 -04:00
Arthur Neves
596669cfac
Remove not needed line on test 2016-06-14 12:37:50 -04:00
Rafael Mendonça França
f27a932d6f
Fix error message to talk about the scale not precision of the type
Fixes #25391
2016-06-13 13:01:32 -04:00
Rafael Mendonça França
e29eb9feb5
Merge pull request #24756 from gsamokovarov/always-inherit-from-application-record
Always genererate models with ApplicationRecord parent
2016-06-13 11:25:55 -04:00
Rafael França
a9734859ce Merge pull request #25319 from morgoth/generate-application-record-first
Generate application_record.rb file before model file
2016-06-13 11:24:33 -04:00
Sean Griffin
1efc81ba8f Merge pull request #25374 from kamipo/fix_calculate_with_string_in_from_and_eager_loading
Fix `calculate` with a string value in `from` and eager loading
2016-06-13 11:03:38 -04:00
Sean Griffin
2806203f10 Merge pull request #25372 from kamipo/remove_assert_date_from_db
Remove unnecessary `assert_date_from_db`
2016-06-13 10:53:15 -04:00
Sean Griffin
7d883b8293 Add codeclimate and rubocop config files
We're going to be experimenting with a new bot for them. This will not
cause anything to start affecting new PRs yet, but it will have data
sent to them so they can do "dry run" stuff on their end.

The rubocop file is based on our documented style guide. I've only
included rules which are either already consistently applied throughout
the entire codebase, or where added lines should be following the
guideline regardless of the surrounding code (such as hash syntax)
2016-06-13 10:29:50 -04:00
Ryuta Kamizono
681a0a0299 Fix calculate with a string value in from and eager loading
`construct_relation_for_association_calculations` pass a string value to
`construct_join_dependency` when setting a string value in `from`.
It should not pass a string value, but always `joins_values`.

Related #14834, #19452.

Fixes #24193.
2016-06-13 01:13:54 +09:00
Eileen M. Uchitelle
8a39123d5d Merge pull request #25362 from maclover7/jm-rm-ar-require
Remove unnecessary model requires
2016-06-12 09:22:17 -04:00
Ryuta Kamizono
4e545d0e43 Remove unnecessary assert_date_from_db
`assert_date_from_db` was added at 6a2104d for SQL Server.
But latest sqlserver adapter work to pass expected behavior since
8e4624b.
2016-06-12 20:54:03 +09:00
Ryuta Kamizono
5deb44d6ea Remove outdated comments [ci skip]
These comments were added at dd257a3ccb30ab181cd48d3d81bc7f23bb45f36f
but outdated since #2086.
2016-06-12 20:30:10 +09:00
Francesco Rodriguez
65f96f3805 Fix typo
[ci skip]
2016-06-12 00:22:36 +02:00
Ryuta Kamizono
97c01bc776 Fix or result SQL [ci skip] 2016-06-11 20:28:50 +09:00
Jon Moss
b1a00fbc75
Remove unnecessary model requires 2016-06-10 22:20:19 -04:00
Prathamesh Sonpatki
8f7ab13643
Reuse existing validate_index_length! method
- Followup of 1ea6cc1121.
2016-06-09 15:50:57 -07:00
Sean Griffin
d65320714e Remove dead code from tests
This code was added in 81286f858770e0b95e15af37f19156b044ec6a95, but was
not used by that commit and does not appear to have ever been used.
2016-06-09 11:19:41 -04:00
Sean Griffin
6990fd3e2a Merge pull request #25329 from yahonda/allow_oracle_bind_value_syntax_in_loj_test
Allow Oracle bind parameter syntax `:a1` in test_join_conditions_added_to_join_clause
2016-06-09 09:30:53 -04:00
Abhishek Jain
a3ac43f4d2 Fix typo 2016-06-09 10:45:38 +05:30
Yasuo Honda
d207023f83 Allow Oracle bind parameter syntax :a1 2016-06-08 17:17:22 +00:00
Wojciech Wnętrzak
b991017bf1
Generate application_record.rb file before model file
Previously model file was generated first, which resulted in
inheriting from `ActiveRecord::Base`, but since application_record.rb
is generated as well, it should already be used.
2016-06-08 08:52:12 +02:00
Ryuta Kamizono
7b7b7c5ce6 Extract foreign key action from information_schema
Fixes #25300.
2016-06-07 06:26:49 +09:00
Ryuta Kamizono
16bb3d6f12 Make foreign_keys queries to SCHEMA 2016-06-07 06:16:56 +09:00
Ryuta Kamizono
aa062318c4 Avoid type casting in uniqueness validator
Type casting in uniqueness validator is for a string value truncation.
It was removed at #23523.
2016-06-04 23:15:46 +09:00
Ryuta Kamizono
faed011acc Fix sqlite3 test failure
Sqlite3 test failure is due to 66ebbc4952f6cfb37d719f63036441ef98149418.
2016-06-04 16:03:44 +09:00
Arthur Neves
66ebbc4952
Dont re-define class SQLite3Adapter on test
We were declaring  in a few tests, which depending of
the order load will cause an error, as the super class could change.

see ac1c4e141b (commitcomment-17731383)
2016-06-03 17:17:53 -04:00