| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
Currently uniqueness validator is coupled with building Arel ASTs.
This commit extracts `PredicateBuilder::CaseSensitiveHandler` for
decouple the building Arel ASTs.
|
| |
|
|\
| |
| | |
Avoid to allow unused splat args for `t.timestamps` in `create_table`
|
| |
| |
| |
| |
| |
| | |
Unfortunately `t.timestamps` in `create_table` allows unused splat args.
But the same one in `change_table` does not allow them.
This commit fixes the inconsistent behavior.
|
|\ \
| | |
| | |
| | | |
Refactor `quoted_columns_for_index` by extracted `add_options_for_index_columns`
|
| |/ |
|
|\ \
| | |
| | | |
Support multiple indexes on the same column when loading the schema
|
| | | |
|
| |/
|/|
| |
| |
| |
| |
| |
| | |
Style/SpaceBeforeBlockBraces
Style/SpaceInsideBlockBraces
Style/SpaceInsideHashLiteralBraces
Fix all violations in the repository.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If you call `remove_index` with wrong options, say a type, like I did,
you get:
```
== 20160810072541 RemoveUniqueIndexOnGoals: migrating =========================
-- remove_index(:goal, {:coulmn=>:kid_id, :unique=>true})
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:
undefined method `ArgumentError' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter:0x007fb7dec91b28>
```
What happened is that I mistyped column (coulmn) and got a
`NoMethodError`, because of a missing comma during the raise. This made
Ruby think we're calling the method `ArgumentError`.
|
| |
| |
| |
| | |
Hash syntax auto-correcting breaks alignments. 411ccbdab2608c62aabdb320d52cb02d446bb39c
|
| | |
|
|\ \
| | |
| | | |
Revert passing arel node with splat binds for `where`
|
| | |
| | |
| | |
| | |
| | | |
A `value` is only used for checking `value.nil?`. It is unnecessary if
immediately return when `value.nil?`.
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
|/ /
| |
| |
| |
| | |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
|\ \
| | |
| | | |
Make `name` and `binds` to optional args for `exec_{insert,update,delete}`
|
| | |
| | |
| | |
| | |
| | |
| | | |
`insert`, `update`, `delete`, and `exec_query` have a default value
against `name` and `binds`. But `exec_insert`, `exec_update`, and
`exec_delete` not have. It is an inconvenience and inconsistent.
|
| | | |
|
|/ / |
|
|\ \
| | |
| | |
| | |
| | |
| | | |
Introduce new ActiveRecord transaction error classes
Closes #26018
|
| | | |
|
| | | |
|
|\ \ \
| |_|/
|/| | |
|
| | |
| | |
| | |
| | | |
- Followup of https://github.com/rails/rails/pull/23179.
|
|\ \ \
| | | |
| | | | |
Remove `prepare_binds_for_database` internal method
|
| | | |
| | | |
| | | |
| | | | |
To avoid relying on the connection adapter for type casting binds.
|
|\ \ \ \
| | | | |
| | | | | |
Prevent `table_comment` query if a table doesn't have a comment
|
| | | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
kamipo/avoid_calling_current_database_in_table_comment
Avoid calling `current_database` in `table_comment`
|
| | |/ / /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | | |
`current_database` executes a query and `table_comment` is called to all
tables even if a table does not have a comment. Using `current_database`
increases extra queries.
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Caching a mutable string causes the following issue.
```
Loading development environment (Rails 5.1.0.alpha)
irb(main):001:0> ActiveRecord::Base.connection.quote_table_name('foo') << '!!'
=> "`foo`!!"
irb(main):002:0> ActiveRecord::Base.connection.quote_table_name('foo') << '!!'
=> "`foo`!!!!"
irb(main):003:0> ActiveRecord::Base.connection.quote_table_name('foo') << '!!'
=> "`foo`!!!!!!"
```
|
| | | |
| | | |
| | | | |
[Rafael Mendonça França + Takeshi AKIMA]
|
|\ \ \ \
| | | | |
| | | | |
| | | | |
| | | | | |
kamipo/decouple_statement_cache_from_connection_adapter
Decouple statement cache from connection adapter
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
`StatementCache` is hard-coded in `cacheable_query` and be passed
`visitor` and `collector` from connection adapter. Simply it is
enough to pass a collected value.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Quoting booleans should return a frozen string
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
If reuse `QUOTED_TRUE` and `QUOTED_FALSE` without frozen, causing the
following issue.
```
Loading development environment (Rails 5.1.0.alpha)
irb(main):001:0> ActiveRecord::Base.connection.quote(true) << ' foo'
=> "1 foo"
irb(main):002:0> ActiveRecord::Base.connection.quote(true) << ' foo'
=> "1 foo foo"
irb(main):003:0> type = ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::MysqlString.new
=> #<ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::MysqlString:0x007fd40c15e018 @precision=nil, @scale=nil, @limit=nil>
irb(main):004:0> type.serialize(true) << ' bar'
=> "1 foo foo bar"
irb(main):005:0> type.cast(true) << ' bar'
=> "1 foo foo bar bar"
```
|
|\ \ \ \ \ \
| |/ / / / /
|/| | | | | |
Extract `type_casted_binds` method
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Because `type_cast` against `binds` always requires
`attr.value_for_database` and this pattern appears frequently.
|
| |/ / / /
|/| | | | |
|
|/ / / /
| | | |
| | | |
| | | |
| | | | |
Where appropriatei, prefer the more concise Regexp#match?,
String#include?, String#start_with?, or String#end_with?
|
|\ \ \ \
| | | | |
| | | | |
| | | | |
| | | | | |
kamipo/move_warning_about_composite_primary_key_to_attribute_methods_primary_key
Move the warning about composite primary key to `AttributeMethods::PrimaryKey`
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Actually schema dumper/creation supports composite primary key (#21614).
Therefore it should not show the warning about composite primary key in
connection adapter.
This change moves the warning to `AttributeMethods::PrimaryKey` and
suppress the warning for habtm join table.
Fixes #25388.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Do not `binds.dup` in `connection#to_sql`
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Because `connection#to_sql` does not mutate `binds`.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Refactored method `ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements#default_sequence_name`. Refactored test `HasManyAssociationsTest#test_do_not_call_callbacks_for_delete_all`.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
`ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements#default_sequence_name`
|