Commit Graph

15129 Commits

Author SHA1 Message Date
Vipul A M
7b37e3edaf Move comment up to the class, for both of the methods, and document on class level why we are doing this.
[ci skip]
2016-05-01 02:44:52 +05:30
Vijay Dev
9d1bf059c0 Merge branch 'master' of github.com:rails/docrails
Conflicts:
	guides/source/configuring.md
2016-04-29 16:00:15 +00:00
Keenan Brock
ba05b3c218 test the number of times the schema is loading 2016-04-28 17:48:41 -04:00
Keenan Brock
dffbba1e2a schema_load triggers 2nd schema_load (via locking)
Currently, loading the schema (schema_load)
accesses the locking column (locking_column)
which defaults the value (reset_locking_column)
which invalidates the schema (reload_schema_from_cache)
which forces another schema load.

Good news:
The second schema_load does accesses locking_column,
but locking_column is set, so it does not reset_locking_column
and it does not trigger an infinite loop.

The solution is not invalidate the cache while default locking_column
2016-04-28 17:48:41 -04:00
eileencodes
f7a986012a Prep Rails 5 beta 4 2016-04-27 15:48:47 -05:00
Rafael França
4a4eedb240 Merge pull request #24730 from vipulnsward/move-savepoints
Move remaining current_savepoint_name to savepoints module
2016-04-25 19:19:58 -03:00
Vipul A M
2af2d6b057 Dont simply assume a type is a valid database type. This is only always true in the case of sqlite.
Others adapters need to perform a check for validity.
Add coverage for mysql2 db type validation
2016-04-25 23:35:36 +05:30
Vipul A M
d58d9f713c Move remaining current_savepoint_name to savepoints module 2016-04-25 23:21:56 +05:30
Ryuta Kamizono
edc2b77187
Add Expression Indexes and Operator Classes support for PostgreSQL
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>
2016-04-24 14:56:29 -07:00
Seva Orlov
c41ef01aec
remove_index do not fetch indexes if name is specified
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>
2016-04-24 14:32:55 -07:00
Vipul A M
6c6eeda54d
Follow up of #23461
- Rename max to statement_limit
- Remove magic number 1000 from everywhere
- Defined StatementPool::DEFAULT_STATEMENT_LIMIT and started using it everywhere

Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
2016-04-24 13:28:48 -07:00
Vipul A M
35f32036b6
Include the Savepoints module in all adapters.
Adapters override `#supports_savepoints?` to return `true` if they
support transaction savepoints. Defaults to `false`.
2016-04-24 10:53:40 -07:00
Vipul A M
2fab3eee1f :nodoc: internal StatementPool class.
[ci skip]
2016-04-24 21:22:12 +05:30
Vipul A M
0f91e2bc25 s/statment/statement/ 2016-04-24 16:24:19 +05:30
Jeremy Daer
ab56c92f3c
Merge pull request #23461 from kamipo/prepared_statements_for_mysql2_adapter
Add prepared statements support for `Mysql2Adapter`
2016-04-23 22:28:52 -07:00
Jeremy Daer
7c45fa57a1
Merge pull request #24708 from kamipo/move_select_rows_implementation_to_super_class
Move `select_rows` implementation to super class
2016-04-23 21:26:33 -07:00
Guillermo Iguaran
77cd14bbbf Merge pull request #24705 from kamipo/add_nodoc_to_insert_versions_sql
Add `:nodoc:` to `insert_versions_sql` [ci skip]
2016-04-23 22:52:47 -05:00
Guillermo Iguaran
9f8a6c47c8 Merge pull request #24706 from kamipo/remove_in_doc_about_mysql_versions_below_5
Remove in the doc about MySQL versions below 5 [ci skip]
2016-04-23 22:50:26 -05:00
Ryuta Kamizono
c1ab4a2dbf Move select_rows implementation to super class 2016-04-24 11:20:46 +09:00
Ryuta Kamizono
9c8a086863 Move require 'ipaddr' in postgresql/oid/cidr.rb
`IPAddr` is used in `OID::Cidr`.
2016-04-24 11:09:08 +09:00
Ryuta Kamizono
7ec31ac429 Remove in the doc about MySQL versions below 5 [ci skip]
Follow up to #23458.
Active Record supports MySQL >= 5.0 now.
2016-04-24 11:02:30 +09:00
Ryuta Kamizono
5394f2cde8 Add :nodoc: to insert_versions_sql [ci skip]
Follow up to #24685. `insert_versions_sql` is not public API.
2016-04-24 10:54:53 +09:00
Vipul A M
210729c4cc Followup of #15771
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
2016-04-24 04:01:18 +05:30
Jeremy Daer
4c76ce6404
Schema load: Fix dupe version insert
Re. 6e098284e97250eaed6f30f5c7c362d87da986b0
2016-04-22 18:32:47 -07:00
Jeremy Daer
a14c811026
Merge pull request #24685 from vipulnsward/sqlite-compat-for-multi-insert
Gracefully fallback on version migrations for sqlite < 3.7.11
2016-04-22 15:33:59 -07:00
Vipul A M
6e098284e9 42dd2336b3 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]
2016-04-23 03:18:13 +05:30
Sean Griffin
1ca6f7f767 Do not attempt to return connection with open transaction to pool (#24610)
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
2016-04-22 12:56:43 -06:00
Rafael França
875c679a33 Merge pull request #24672 from mrkjlchvz/mc-space-bump
Minor space bump.
2016-04-21 10:51:47 -03:00
Mark
64bf0fcff4 Minor space bump. 2016-04-21 19:20:54 +08:00
प्रथमेश Sonpatki
868a49262c Revert "add doc for :type option of #create_join_table [ci skip]" 2016-04-21 07:54:06 +05:30
yuuji.yaginuma
1a409956de add doc for :type option of #create_join_table [ci skip]
Follow up to #24221.
2016-04-21 11:09:53 +09:00
Ryuta Kamizono
3f6574efb1 Add prepared statements support for Mysql2Adapter 2016-04-21 09:17:42 +09:00
Kasper Timm Hansen
3ff6b800f2 Merge pull request #24221 from gregmolnar/uuid
create_join_table should work with uuid
2016-04-20 22:13:17 +02:00
Jeremy Daer
3b38fb3d57
Merge pull request #23557 from kamipo/dump_indexes_in_create_for_generates_sql_in_one_query
Dump indexes in `create_table` for generates SQL in one query
2016-04-20 11:05:22 -07:00
Ryuta Kamizono
67f4994a0b
undef_method is not needed 2016-04-19 23:03:46 -07:00
Ryuta Kamizono
74b5112282 Dump indexes in create_table for generates SQL in one query
If the adapter supports indexes in create table, it generates SQL
in one query.
2016-04-20 10:24:18 +09:00
Ryuta Kamizono
da87a679c5 Fix test_blank_columns_created_in_block
Follow up to 1683410.
2016-04-20 07:38:04 +09:00
Jon Moss
1909095aea Remove unecessary comment 2016-04-19 16:48:40 -04:00
Jeremy Daer
1683410c5e
Database comments: Treat blank comments as no comment. Don't dump blank comments. 2016-04-19 12:31:23 -07:00
Ryuta Kamizono
dd58c3bf23 Define arel_visitor method on all adapters
`Arel::Visitors::VISITORS` was removed at https://github.com/rails/arel/pull/412.
2016-04-20 01:27:08 +09:00
Ryuta Kamizono
a80e944e18 Remove unused table_with_autoincrement table 2016-04-19 17:17:19 +09:00
Jeremy Daer
0c77018f8d
Merge pull request #24317 from Gaurav2728/unused_set_in_active_record
connection adapters column, delegation in Active Record have not use …
2016-04-19 01:08:39 -07:00
Jeremy Daer
db06ad6149
Merge pull request #24503 from prathamesh-sonpatki/add-test-for-warn-on-records-fetched-greater-than
Add missing test case for record_fetched_greater_than config
2016-04-19 01:06:04 -07:00
Jeremy Daer
0575f4646a
Merge pull request #24576 from yahonda/quote_column_name_for_reserved_word_size
Address ORA-00923 error by quoting a reserved word "SIZE"
2016-04-19 00:59:38 -07:00
Jeremy Daer
ca13731e61
Merge pull request #23497 from kamipo/extract_schema_qualified_name
Extract `extract_schema_qualified_name` method
2016-04-19 00:44:10 -07:00
Jeremy Daer
7854e69c74
Merge pull request #23515 from kamipo/extract_arel_visitor
Extract `arel_visitor` and move up to the abstract adapter
2016-04-19 00:43:11 -07:00
Jeremy Daer
f2f2d64429
Merge pull request #23523 from kamipo/avoid_truncation_in_uniqueness_validation
Avoid a string value truncation in uniqueness validation
2016-04-18 17:53:22 -07:00
Jeremy Daer
446190fbd2
Merge pull request #23522 from kamipo/add_value_too_long_exception_class
Add `ActiveRecord::ValueTooLong` exception class
2016-04-18 17:31:28 -07:00
Jeremy Daer
b36078fb8b
Merge pull request #24614 from kamipo/foreign_key_respects_table_name_prefix_and_suffix
`foreign_key` respects `table_name_prefix` and `table_name_suffix`
2016-04-18 17:21:28 -07:00
Ryuta Kamizono
0cae0ce5ce foreign_key respects table_name_prefix and table_name_suffix 2016-04-19 07:33:31 +09:00