aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
Commit message (Collapse)AuthorAgeFilesLines
* Fix varbinary with default ''Ryuta Kamizono2015-12-241-0/+10
| | | | | | | A `(?:var)?binary` with default '' is a correct definition. Remove `missing_default_forged_as_empty_string?` method for fixing this issue because this method is a workaround for older mysql legacy adapter (19c99ac, f7015336).
* Fixes LoggerSilence#silence threadsafetyCarl P. Corliss2015-12-231-0/+1
| | | | | | | - uses instance defined level if no custom local log level defined - Keeps track of local log level per [ thread + object-instance ] - prevents memory leakage by removing local level hash key/value on #silence method exit - avoids the use of Thread local variables
* Add support for passing flags to MySQL2 adapter by arrayStephen Blackstone2015-12-221-1/+8
|
* Revert "Merge pull request #22486 from ↵Yves Senn2015-12-211-17/+0
| | | | | | | | | | | | | | | | | | methyl/fix-includes-for-groupped-association" This reverts commit 537ac7d6ade61e95f2b70685ff2236b7de965bab, reversing changes made to 9c9c54abe08d86967efd3dcac1d65158a0ff74ea. Reason: The way we preload associations will change the meaning of GROUP BY operations. This is illustrated in the SQL generated by the added test (failing on PG): Association Load: D, [2015-12-21T12:26:07.169920 #26969] DEBUG -- : Post Load (0.7ms) SELECT "posts".* FROM "posts" LEFT JOIN comments ON comments.post_id = posts.id WHERE "posts"."author_id" = $1 GROUP BY posts.id ORDER BY SUM(comments.tags_count) [["author_id", 1]] Preload: D, [2015-12-21T12:26:07.128305 #26969] DEBUG -- : Post Load (1.3ms) SELECT "posts".* FROM "posts" LEFT JOIN comments ON comments.post_id = posts.id WHERE "posts"."author_id" IN (1, 2, 3) GROUP BY posts.id ORDER BY SUM(comments.tags_count)
* Merge pull request #22486 from methyl/fix-includes-for-groupped-associationYves Senn2015-12-211-0/+17
|\ | | | | | | | | | | | | Pass group values when including association Conflicts: activerecord/CHANGELOG.md
| * Pass SQL group by values when including scoped associationLucjan Suski2015-12-151-0/+13
| | | | | | | | | | Fixes problem when added `group()` in association scope was lost in eager loaded association.
* | Remove legacy mysql adapterRyuta Kamizono2015-12-216-85/+75
| | | | | | | | Follow up to #22642.
* | Remove unused `test/schema/mysql_specific_schema.rb`Ryuta Kamizono2015-12-191-62/+0
| | | | | | | | Follow up to #22642.
* | Merge pull request #19423 from ↵Aaron Patterson2015-12-181-0/+6
|\ \ | | | | | | | | | | | | yuroyoro/fix_performance_regression_of_preloading_has_many_through_relation Fix #12537 performance regression when preloading has_many_through association
| * | Read already loaded association records from association.targetTomohito Ozaki2015-04-171-0/+6
| | | | | | | | | | | | | | | For performance, Avoid instantiate CollectionProxy. Fixes #12537
* | | Handle specified schemas when removing a Postgres indexGrey Baker2015-12-181-0/+14
| | |
* | | Merge pull request #22653 from matthewd/find_array_orderedMatthew Draper2015-12-182-2/+76
|\ \ \ | | | | | | | | | | | | ActiveRecord::Base#find(array) returning result in the same order as the array passed
| * | | Implement limit & offset for ourselvesMatthew Draper2015-12-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We know the query will return exactly one row for each entry in the `ids` array, so we can do all the limit/offset calculations on that array, in advance. I also split our new ordered-ids behaviour out of the existing `find_some` method: especially with this change, the conditionals were overwhelming the actual logic.
| * | | Adding a new test using chained where, limit and find([pks])Miguel Grazziotin2015-08-071-2/+12
| | | |
| * | | WIP: fixing the limit bug and introducing new tests (failing for now) on ↵Miguel Grazziotin2015-06-191-4/+25
| | | | | | | | | | | | | | | | .find(array) with offset
| * | | do not change the order of the result if the object was already ordered by ↵Miguel Grazziotin2015-06-051-0/+5
| | | | | | | | | | | | | | | | the user via :order clause
| * | | adding a test to ensure the find is obbeying the limitMiguel Grazziotin2015-06-031-0/+7
| | | |
| * | | [#20338] adding tests to ensure the order clause takes precedenceMiguel Grazziotin2015-06-031-0/+18
| | | |
| * | | [#20338] improving implementation, fixing and adding some more specsMiguel Grazziotin2015-06-031-1/+2
| | | |
| * | | [#20338] WIP: first basic implementation and specsMiguel Grazziotin2015-05-291-0/+12
| | | |
* | | | These limits are now implicitMatthew Draper2015-12-182-2/+2
| | | |
* | | | Merge pull request #20815 from ↵Matthew Draper2015-12-181-1/+1
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | byroot/do-not-include-column-limit-if-it-is-default Do not include column limit in schema.rb if it matches the default
| * | | | Do not include column limit in schema.rb if it matches the defaultJean Boussier2015-07-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When working on engines that supports multiple databases, it's very annoying to have a different schema.rb output based on which database you use. MySQL being the primary offender. This patch should reduce the disparities a bit.
* | | | | Merge pull request #22623 from greysteil/support-passing-schema-name-to-indexesMatthew Draper2015-12-181-0/+5
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | Support passing the schema name prefix to `conenction.indexes`
| * | | | | Support passing the schema name prefix to `conenction.indexes`Grey Baker2015-12-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support passing the schema name as a prefix to table name in `ConnectionAdapters::SchemaStatements#indexes`. Previously the prefix would be considered a full part of the index name, and only the schema in the current search path would be considered.
* | | | | | Merge pull request #19456 from greysteil/index-exists-behaviourMatthew Draper2015-12-184-5/+57
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | Ignore index name in `index_exists?` when not passed a name to check for
| * | | | | | Support removing custom-names indexes when only specifying column namesGrey Baker2015-12-154-5/+55
| | | | | | |
| * | | | | | Ignore index name in `index_exists?` when not passed a name to check forGrey Baker2015-12-151-0/+2
| | |_|_|_|/ | |/| | | |
* | | | | | Merge pull request #22642 from seuros/remove-mysql-adapterMatthew Draper2015-12-1842-1226/+47
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | Remove legacy mysql adapter
| * | | | | | Remove legacy mysql adapterAbdelkader Boudih2015-12-1742-1226/+47
| | |/ / / / | |/| | | |
* / | | | | Call the new point behavior `:point`, not `:rails_5_1_point`Sean Griffin2015-12-171-4/+4
|/ / / / / | | | | | | | | | | | | | | | | | | | | Since the attributes API is new in Rails 5, we don't actually need to keep the behavior of `attribute :point`, as it's not a breaking change.
* | | | | Don't over-specify types in our testsSean Griffin2015-12-161-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This test was failing when run on Windows using PostgreSQL. Depending on the OS (and 32 vs 64 bit), this type could be a `BigNum`. We could loosen the assertion to `Numeric`, but if the value is equal to the expected, and responds to `bitlength` properly, who cares?
* | | | | Fix test failures on WindowsSean Griffin2015-12-161-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unlike unix, the TZ variable on Windows does not look at a database. It is always expected to be in the form {Standard Time Abbreviation}{UTC-Offset}{Daylight Time Abbriviation}. This changes the relevant tests to use the Windows form when run from Windows.
* | | | | Fix test failure on WindowsSean Griffin2015-12-161-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When this test was run on Windows, the database file would still be in use, and `File.unlink` would fail. This would cause the temp directory to be unable to be removed, and error out. By disconnecting the connection when finished, we can avoid this error.
* | | | | Merge pull request #22605 from tonyta/delete-dead-commentsRafael França2015-12-161-1/+0
|\ \ \ \ \ | | | | | | | | | | | | Delete dead code comments
| * | | | | deletes commented code introduced in db045db (initial commit)Tony Ta2015-12-151-1/+0
| | | | | |
* | | | | | Merge pull request #22598 from yui-knk/deprecate_string_callbackRafael França2015-12-161-1/+1
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Deprecate passing string to define callback.
| * | | | | Deprecate passing string to define callback.yui-knk2015-12-161-1/+1
| | | | | |
* | | | | | Merge pull request #22562 from sblackstone/masterJeremy Daer2015-12-151-0/+7
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | Allow users to pass flags from database.yml
| * | | | | Allow users to pass flags from database.ymlStephen Blackstone2015-12-151-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix white-space Add test case demonstrating flags are received by the adapter
* | | | | | Internal test migrations use the private 'Current' versionMatthew Draper2015-12-1536-49/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apart from specific versioning support, our tests should focus on the behaviour of whatever version they're accompanying, regardless of when they were written. Application code should *not* do this.
* | | | | | Ensure uuid-ossp extension is present before we rely on itMatthew Draper2015-12-151-0/+2
| | | | | |
* | | | | | Revert "Perform a more efficient query in `Relation#any?`"Sean Griffin2015-12-141-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 6d5b1fdf55611de2a1071c37544933bb588ae88e. `eager_load` and `references` can include hashes, which won't match up with `references` A test case has been added to demonstrate the problem
* | | | | | Merge pull request #22395 from avokhmin/becomes-errors-base-2Sean Griffin2015-12-141-1/+20
|\ \ \ \ \ \ | | | | | | | | | | | | | | `ActiveRecord::Base#becomes` should copy the errors
| * | | | | | `ActiveRecord::Base#becomes` should copy the errorsVokhmin Alexey V2015-12-141-1/+20
| | | | | | |
* | | | | | | Fix test failures caused by 574f255Sean Griffin2015-12-141-1/+1
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | There was a test remaining for PG only that was checking for an exact limit clause
* | | | | | Use a bind param for `LIMIT` and `OFFSET`Sean Griffin2015-12-142-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently generate an unbounded number of prepared statements when `limit` or `offset` are called with a dynamic argument. This changes `LIMIT` and `OFFSET` to use bind params, eliminating the problem. `Type::Value#hash` needed to be implemented, as it turns out we busted the query cache if the type object used wasn't exactly the same object. This drops support for passing an `Arel::Nodes::SqlLiteral` to `limit`. Doing this relied on AR internals, and was never officially supported usage. Fixes #22250.
* | | | | | Deprecate limit strings with commasSean Griffin2015-12-141-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some backends allow `LIMIT 1,2` as a shorthand for `LIMIT 1 OFFSET 2`. Supporting this in Active Record massively complicates using bind parameters for limit and offset, and it's trivially easy to build an invalid SQL query by also calling `offset` on the same `Relation`. This is a niche syntax that is only supported by a few adapters, and can be trivially worked around by calling offset explicitly.
* | | | | | Merge pull request #22209 from ↵Sean Griffin2015-12-141-0/+10
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | yui-knk/add_test_sanitize_sql_array_handles_named_bind_variables Add test cases for `#sanitize_sql_array` with named_bind_variables
| * | | | | | Add test cases for `#sanitize_sql_array` with named_bind_variablesyui-knk2015-11-091-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And add code examples to `sanitize_sql_for_conditions`, `sanitize_sql_for_assignment`, and `sanitize_sql_array`.