aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | 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-1841-1217/+47
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove legacy mysql adapter
| * | | | | | | | Remove legacy mysql adapterAbdelkader Boudih2015-12-1741-1217/+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-158-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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`.
* | | | | | | | Merge pull request #22571 from mtsmfm/travel-backSantiago Pastorino2015-12-131-3/+3
|\ \ \ \ \ \ \ \ | |_|_|/ / / / / |/| | | | | | | travel back
| * | | | | | | travel backFumiaki MATSUSHIMA2015-12-131-3/+3
| | |/ / / / / | |/| | | | |
* | | | | | | Merge pull request #22381 from yahonda/use_adapter_subsecond_precision_supportedAaron Patterson2015-12-133-60/+13
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | Use adapter supports_datetime_with_precision
| * | | | | | Consolidate tests for time and datetime columns options, limit and precisionYasuo Honda2015-11-302-59/+12
| | | | | | |
| * | | | | | Use adapter supports_datetime_with_precision to support 3rd party adapter testsYasuo Honda2015-11-301-1/+1
| | | | | | |
* | | | | | | Make sure we touch all the parents when touch_later.Arthur Neves2015-12-061-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem was that when saving an object, we would call touch_later on the parent which wont be saved immediteally, and it wont call any callbacks. That was working one level up because we were calling touch, during the touch_later commit phase. However that still didnt solve the problem when you have a 3+ levels of parents to be touched, as calling touch would affect the parent, but it would be too late to run callbacks on its grand-parent. The solution for this, is instead, call touch_later upwards when the first touch_later is called. So we make sure all the timestamps are updated without relying on callbacks. This also removed the hard dependency BelongsTo builder had with the TouchLater module. So we can still have the old behaviour if TouchLater module is not included. [fixes 5f5e6d924973003c105feb711cefdb726f312768] [related #19324]
* | | | | | | Introduce after_{create,update,delete}_commit callbacksGenadi Samokovarov2015-12-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Those are actually shortcuts for `after_commit`. Before: after_commit :add_to_index_later, on: :create after_commit :update_in_index_later, on: :update after_commit :remove_from_index_later, on: :destroy After: after_create_commit :add_to_index_later after_update_commit :update_in_index_later after_destroy_commit :remove_from_index_later
* | | | | | | remove warning from postgresql geometric testyuuji.yaginuma2015-12-051-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes the following warning which has been out in the case of a PostgreSQL 9.3 below. ``` activerecord/test/cases/adapters/postgresql/geometric_test.rb:265: warning: instance variable @connection not initialized ```
* | | | | | | don't rely on the columns hash to get defaults. follow-up to #17169.Yves Senn2015-12-021-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will also get the defaults from attribute definitions like: attribute :type, :string, default: "SomethingElse"
* | | | | | | add `ActiveRecord::Base.has_attribute?`Yves Senn2015-12-021-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | `has_attribute?` method to check wether a given attribute has been defined.
* | | | | | | Merge pull request #17169 from kuldeepaggarwal/fix-STI-default-typeYves Senn2015-12-021-0/+21
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | STI cast new instances to `default type` on initialize.