aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
Commit message (Collapse)AuthorAgeFilesLines
* Should quote `lock_name` to pass to `get_advisory_lock`Ryuta Kamizono2016-05-101-3/+3
|
* Merge pull request #24844 from arthurnn/arthurnn/connArthur Nogueira Neves2016-05-066-30/+43
|\ | | | | Refactor connection handler
| * s/specification_name/connection_specification_nameArthur Neves2016-05-061-2/+2
| |
| * s/specification_id/specification_nameArthur Neves2016-05-053-13/+13
| |
| * Test to swap connection at runtimeArthur Neves2016-05-051-0/+7
| |
| * fix testArthur Neves2016-05-051-8/+7
| |
| * Add spec_id testsArthur Neves2016-05-051-0/+9
| |
| * Use spec key, when given as spec_idArthur Neves2016-05-051-19/+15
| |
| * Refactor connection handlerArthur Neves2016-05-055-33/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ConnectionHandler will not have any knowlodge of AR models now, it will only know about the specs. Like that we can decouple the two, and allow the same model to use more than one connection. Historically, folks used to create abstract AR classes on the fly in order to have multiple connections for the same model, and override the connection methods. With this, now we can override the `specificiation_id` method in the model, to return a key, that will be used to find the connection_pool from the handler.
* | Merge pull request #24871 from vipulnsward/disable-transaction-failureArthur Nogueira Neves2016-05-061-0/+2
|\ \ | | | | | | Fix failures due to transactions
| * | We are erroring due to nested transaction failures from mysql on ↵Vipul A M2016-05-061-0/+2
| |/ | | | | | | | | | | | | | | test_migrate_clears_schema_cache_afterward test. Disable transactions for this test. Fixes #24391
* / Allow the connection adapters to determine the order of bind paramsSean Griffin2016-05-061-0/+18
|/ | | | | | | | | | | | In 5.0 we use bind parameters for limit and offset, while in 4.2 we used the values directly. The code as it was written assumed that limit and offset worked as `LIMIT ? OFFSET ?`. Both Oracle and SQL Server have a different syntax, where the offset is stated before the limit. We delegate this behavior to the connection adapter so that these adapters are able to determine how the bind parameters are flattened based on what order their specification has the various clauses appear. Fixes #24775
* Fix some typos in comments.Joe Rafaniello2016-05-042-2/+2
| | | | [ci skip]
* Followup of #24835Vipul A M2016-05-033-5/+5
| | | | Fix failing tests
* Do not delegate `AR::Base#empty?` to `all`Sean Griffin2016-05-021-6/+0
| | | | | | | | | | Unlike `one?` and `none?`, `empty?` has interactions with methods outside of enumerable. It also doesn't fit in the same vein. `Topic.any?` makes sense. `Topic.empty?` does not, as `Topic` is not a container. Fixes #24808 Close #24812
* Merge pull request #24713 from tomkadwill/fix_counter_cache_incrementSean Griffin2016-04-301-0/+11
|\ | | | | | | | | Fix counter_cache double increment bug Close #24183
| * Fix counter_cache double increment bugTom Kadwill2016-04-281-0/+11
| |
* | Replace `Rails.version.to_f` with Active RecordJon Moss2016-04-301-0/+4
| | | | | | | | | | Rails should not be explicity mentioned within Active Record, since railties and the Rails ecosystem is not required for use.
* | rm unused requireVipul A M2016-04-291-1/+0
| | | | | | | | Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* | Extract `add_sql_comment!` methodRyuta Kamizono2016-04-291-3/+3
| | | | | | | | | | | | Refactor of #22911. Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* | Treat blank comments as no comment for indexesRyuta Kamizono2016-04-291-1/+10
| | | | | | | | | | | | Follow up of 1683410. Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* | test the number of times the schema is loadingKeenan Brock2016-04-281-0/+53
|/
* Dont simply assume a type is a valid database type. This is only always true ↵Vipul A M2016-04-251-0/+11
| | | | | | | in the case of sqlite. Others adapters need to perform a check for validity. Add coverage for mysql2 db type validation
* Add Expression Indexes and Operator Classes support for PostgreSQLRyuta Kamizono2016-04-244-20/+52
| | | | | | | | | | | | | | | | Example: create_table :users do |t| t.string :name t.index 'lower(name) varchar_pattern_ops' end Fixes #19090. Fixes #21765. Fixes #21819. Fixes #24359. Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* remove_index do not fetch indexes if name is specifiedSeva Orlov2016-04-242-0/+16
| | | | | | There is no need to fetch all table indexes in remove_index if name is specified. If name is wrong, then StatementInvalid will be raised. Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* Followup of #15771Vipul A M2016-04-241-0/+6
| | | | | | | | | Make sure we handle explicitly passed nil's to lock_version as well. An explicitly passed nil value is now converted to 0 on LockingType, so that we don't end up with ActiveRecord::StaleObjectError in update record optimistic locking Fixes #24695
* Merge pull request #24685 from vipulnsward/sqlite-compat-for-multi-insertJeremy Daer2016-04-221-0/+18
|\ | | | | | | Gracefully fallback on version migrations for sqlite < 3.7.11
| * https://github.com/rails/rails/commit/42dd2336b31a8d98776d039a2b9fd7f834156a ↵Vipul A M2016-04-231-0/+18
| | | | | | | | | | | | | | | | | | 78 changed INSERT INTO versions to run in 1 single query. This breaks for sqlite versions < 3.7.11, which is especially the case on Ubuntu 12.04 LTS, that has SQLite version 3.7.9 as default. So we check for support for multi insert, before performing single query inserts, else fallback to older version of running multiple queries. [Vipul A M & Yasuo Honda]
* | Do not attempt to return connection with open transaction to pool (#24610)Sean Griffin2016-04-221-5/+7
|/ | | | | | | | | | | | | When the query cache completes, if Active Record is still inside of a transaction, it is because the transaction is meant to be left open above this unit of work (such as transactional fixtures in tests). There were several tests around the behavior of "tests" that were invalid, as tests are not run through the executor. They have been changed to reflect the new behavior, which is closer to what actually occurs in Rails tests. Fixes #23989 Fixes #24491 Close #24500
* Merge pull request #24221 from gregmolnar/uuidKasper Timm Hansen2016-04-201-0/+7
|\ | | | | create_join_table should work with uuid
| * add column type option to create_join_table to support uuidGreg Molnar2016-03-171-0/+7
| |
* | Dump indexes in `create_table` for generates SQL in one queryRyuta Kamizono2016-04-202-12/+12
| | | | | | | | | | If the adapter supports indexes in create table, it generates SQL in one query.
* | Remove unecessary commentJon Moss2016-04-191-1/+1
| |
* | Database comments: Treat blank comments as no comment. Don't dump blank ↵Jeremy Daer2016-04-191-55/+96
| | | | | | | | comments.
* | Merge pull request #24503 from ↵Jeremy Daer2016-04-191-11/+23
|\ \ | | | | | | | | | | | | | | | prathamesh-sonpatki/add-test-for-warn-on-records-fetched-greater-than Add missing test case for record_fetched_greater_than config
| * | Add missing test case for record_fetched_greater_than configPrathamesh Sonpatki2016-04-111-11/+23
| | | | | | | | | | | | - The negative scenario test case was missing earlier.
* | | Merge pull request #23523 from kamipo/avoid_truncation_in_uniqueness_validationJeremy Daer2016-04-181-10/+32
|\ \ \ | | | | | | | | | | | | Avoid a string value truncation in uniqueness validation
| * | | Avoid a string value truncation in uniqueness validationRyuta Kamizono2016-02-121-10/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In MySQL, PostgreSQL, Oracle and SQLServer, a value over the limit cannot be inserted or updated (See #23522). In SQLite3, a value is inserted or updated regardless of the limit. We should avoid a string value truncation in uniqueness validation.
* | | | Merge pull request #23522 from kamipo/add_value_too_long_exception_classJeremy Daer2016-04-181-0/+9
|\ \ \ \ | | | | | | | | | | | | | | | Add `ActiveRecord::ValueTooLong` exception class
| * | | | Add `ActiveRecord::ValueTooLong` exception classRyuta Kamizono2016-02-061-0/+9
| | | | |
* | | | | `foreign_key` respects `table_name_prefix` and `table_name_suffix`Ryuta Kamizono2016-04-192-2/+32
| | | | |
* | | | | Merge pull request #23622 from kamipo/primary_key_should_be_not_nullJeremy Daer2016-04-181-1/+1
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | Primary key should be `NOT NULL`
| * | | | | Primary key should be `NOT NULL`Ryuta Kamizono2016-03-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow up to #18228. In MySQL and PostgreSQL, primary key is to be `NOT NULL` implicitly. But in SQLite it must be specified `NOT NULL` explicitly.
* | | | | | Fix isolated test failures due to referencing ↵Jeremy Daer2016-04-183-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | ActiveRecord::Tasks::DatabaseAlreadyExists before another test happened to make it available
* | | | | | Database comments: switch to keyword args for new table optionsJeremy Daer2016-04-181-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Switch to keyword args where we can without breaking compat. * Use add_table_options! for :options, too. * Some code polish.
* | | | | | Merge pull request #24581 from vipulnsward/add-reference-named-unique-index-testYves Senn2016-04-181-0/+5
|\ \ \ \ \ \ | | | | | | | | | | | | | | Add test to verify named unique index, when creating reference via add_reference
| * | | | | | Add test to verify named unique index, when creating reference via add_referenceVipul A M2016-04-161-0/+5
| | | | | | |
* | | | | | | Merge pull request #24551 from bogdanvlviv/notice_for_tasksJeremy Daer2016-04-174-10/+100
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Added notice when a database is successfully created or dropped.
| * | | | | | | Added notice when a database is successfully created or dropped.bogdanvlviv2016-04-174-10/+100
| | | | | | | |
* | | | | | | | Add support for specifying comments for tables, columns, and indexes.Andrey Novikov2016-04-161-0/+91
| |/ / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Comments are specified in migrations, stored in database itself (in its schema), and dumped into db/schema.rb file. This allows to generate good documentation and explain columns and tables' purpose to everyone from new developers to database administrators. For PostgreSQL and MySQL only. SQLite does not support comments at the moment. See docs for PostgreSQL: http://www.postgresql.org/docs/current/static/sql-comment.html See docs for MySQL: http://dev.mysql.com/doc/refman/5.7/en/create-table.html