| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | | | |
|
| | | | |
|
| |_|/
|/| |
| | |
| | |
| | |
| | | |
Some methods were added to public API in
5b14129d8d4ad302b4e11df6bd5c7891b75f393c and they should be not part of
the public API.
|
| | | |
|
| | | |
|
|/ / |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
make sql statements frozen
dup if arel is not our string
expect runtime error
dont wrap runtime error in invalid
log errors will now be treated as runtime errors
update changelog
|
|\ \
| | |
| | | |
Fix `add_index` to normalize column names and options
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Currently does not work the following code.
```ruby
add_index(:people, ["last_name", "first_name"], order: { last_name: :desc, first_name: :asc })
```
Normalize column names and options to fix the issue.
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
SQLite's default query interface ignores anything after the first
semicolon in a query. This is actually quite common behavior in database
drivers, especially when dealing with code paths for prepared statements
(which we are). While this should only affect SQLite, as I'm not aware
of any drivers which don't support multi-insert. Even if this does
affect other third party drivers though, I'd prefer not to assume that
more than one query can be executed per call to `execute`.
Fixes #26948.
Close #27242.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
It'll be re-cleared when it's rebuilt in with_new_connections_blocked's
ensure, but we still need to clear it inside this synchronize -- we've
disconnected connections that may be available in the queue, and while
other threads are not allowed to make *new* connections, they are still
allowed to take existing ones from there.
This was incorrectly removed in d314646c965b045724e6bdb9d61dcecfabc0ba8f.
|
| | |
| | |
| | |
| | |
| | |
| | | |
Two methods block new connections; we were already doing the right thing
for clear_reloadable_connections, but it's better placed in
with_new_connections_blocked, where it can work for disconnect too.
|
|\ \ \
| | | |
| | | |
| | | | |
Fix the race condition caused by `with_new_connections_blocked`
|
|/ / /
| | |
| | |
| | |
| | |
| | | |
`with_new_connections_blocked` was introduced at #14938.
But the method sometimes causes `@new_cons_enabled = false` then never
toggled to true.
|
|\ \ \
| | | |
| | | | |
Add missing `+` around a some literals.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Mainly around `nil`
[ci skip]
|
|\ \ \ \
| | | | |
| | | | | |
Configure query caching (per thread) on the connection pool
|
| | | | | |
|
|/ / / / |
|
|\ \ \ \
| | | | |
| | | | | |
Clear query cache during checkin, instead of an execution callback
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
It doesn't make sense for the query cache to persist while a connection
moves through the pool and is assigned to a new thread.
[Samuel Cochran & Matthew Draper]
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
Remove unnecessary `respond_to?(:indexes)` checking
|
| | |/ /
| |/| |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Currently all adapters (postgresql, mysql2, sqlite3, oracle-enhanced,
and sqlserver) implemented `indexes` and schema dumper expects
implemented `indexes`.
https://github.com/rails/rails/blob/v5.0.0/activerecord/lib/active_record/schema_dumper.rb#L208
Therefore `respond_to?(:indexes)` checking is unnecessary.
|
| |/ /
|/| |
| | |
| | | |
Follow up to 99cf7558000090668b137085bfe6bcc06c4571dc.
|
| | |
| | |
| | |
| | | |
This commit fixes the generated HTML of the two code examples.
|
| | | |
|
| | |
| | |
| | |
| | | |
`migration_keys` includes `name` but `name` is not a column option.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
```ruby
# Before
t.index ["firm_id", "type", "rating"], name: "company_index", order: {"rating"=>:desc}, using: :btree
# After
t.index ["firm_id", "type", "rating"], name: "company_index", order: { rating: :desc }, using: :btree
```
|
|/ /
| |
| |
| |
| | |
Currently blank comment does not dump to `db/schema.rb`. But created it
even if specified blank.
|
|/ |
|
|
|
|
| |
[fixes #26441]
|
| |
|
|
|
|
|
|
| |
All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772.
But comments was still kept absolute position. This commit aligns
comments with method definitions for consistency.
|
| |
|
|\
| |
| | |
Revert "`sql_for_insert` returns values for passing to `exec_insert`"
|
| |
| |
| |
| |
| |
| |
| | |
This reverts #23067. #23067 is for propagating `pk` value from
`sql_for_insert` to `exec_insert` (avoiding extra query for pg adapter).
Now `exec_insert` includes `sql_for_insert` since #26002 therefore this
propagating is no longer needed.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
invalid column type
/activerecord/lib/active_record/connection_adapters
/abstract/schema_definitions.rb:306
type = type.to_sym
Changed to the following to handle nil case:
type = type.to_sym if type
Added regression test for this case:
/activerecord/test/cases/migration_test.rb:554
if current_adapter?(:SQLite3Adapter)
def test_allows_sqlite3_rollback_on_invalid_column_type
Person.connection.create_table :something, force: true do |t|
t.column :number, :integer
t.column :name, :string
t.column :foo, :bar
end
assert Person.connection.column_exists?(:something, :foo)
assert_nothing_raised { Person.connection.remove_column :something, :foo, :bar }
assert !Person.connection.column_exists?(:something, :foo)
assert Person.connection.column_exists?(:something, :name)
assert Person.connection.column_exists?(:something, :number)
ensure
Person.connection.drop_table :something, if_exists: true
end
end
|
|\
| |
| |
| |
| | |
kamipo/sql_for_insert_should_be_called_inside_exec_insert
`sql_for_insert` should be called inside `exec_insert`
|
| |
| |
| |
| |
| | |
`exec_insert` cannot return last inserted id if `use_insert_returning?`
is true. `sql_for_insert` should be called inside `exec_insert`.
|
| | |
|
|\ \
| | |
| | | |
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`.
|