- 01 5月, 2020 8 次提交
-
-
由 Ryuta Kamizono 提交于
`column_types` is empty except PostgreSQL adapter, and `attribute_types.each_key { |k| column_types.delete k }` is also empty even if PostgreSQL adapter almost all case, so that code is quite useless. This improves performance for `find_by_sql` to avoid that useless loop as much as possible. ```ruby ActiveRecord::Schema.define do create_table :active_storage_blobs do |t| t.string :key, null: false t.string :filename, null: false t.string :content_type t.text :metadata t.string :service_name, null: false t.bigint :byte_size, null: false t.string :checksum, null: false t.datetime :created_at, null: false t.index [ :key ], unique: true end end class ActiveStorageBlob < ActiveRecord::Base end Benchmark.ips do |x| x.report("find_by") { ActiveStorageBlob.find_by(id: 1) } end ``` Before: ``` Warming up -------------------------------------- find_by 1.256k i/100ms Calculating ------------------------------------- find_by 12.595k (± 3.4%) i/s - 64.056k in 5.091599s ``` After: ``` Warming up -------------------------------------- find_by 1.341k i/100ms Calculating ------------------------------------- find_by 13.170k (± 3.5%) i/s - 67.050k in 5.097439s ``` To avoid column types loop for PostgreSQL adapter, this skips returning additional column types if a column has already been type casted by pg decoders. Fortunately this fixes #36186 partly for common types.
-
由 Ryuta Kamizono 提交于
-
由 Ryuta Kamizono 提交于
Remove useless type cast on aggregated value
-
由 Ryuta Kamizono 提交于
Update pg gem required version to 1.1
-
由 Ryuta Kamizono 提交于
Relying on the `Arel::Table.engine` is convenient if an app have only a single kind of database, but if not so, the global state is not always the same with the current connection.
-
由 Rafael França 提交于
Batch attribute methods definition
-
由 Jean Boussier 提交于
-
- 30 4月, 2020 5 次提交
-
-
由 Eugene Kenny 提交于
Add override of unary plus for `ActiveSupport::Duration`
-
由 Ryuta Kamizono 提交于
Deprecate `allowed_index_name_length` in `DatabaseLimits`
-
由 Roman Kushnir 提交于
```ruby (+ 1.second).class => ActiveSupport::Duration ``` Fixes #39079.
-
由 Xavier Noria 提交于
The less we depend on require_dependency, the better.
-
由 Ryuta Kamizono 提交于
`allowed_index_name_length` was used for internal temporary operations in SQLite3, since index name in SQLite3 must be globally unique and SQLite3 doesn't have ALTER TABLE feature (so it is emulated by creating temporary table with prefix). `allowed_index_name_length` was to reserve the margin for the prefix, but actually SQLite3 doesn't have a limitation for identifier name length, so the margin has removed at 36901e6e. Now `allowed_index_name_length` is no longer relied on by any adapter, so I'd like to remove the internal specific method which is no longer used.
-
- 29 4月, 2020 10 次提交
-
-
由 Xavier Noria 提交于
-
由 Xavier Noria 提交于
Improve zeitwerk:check warning message [CI skip]
-
由 Ryuta Kamizono 提交于
Related #39039. Currently PostgreSQL adapter is the only adapter that rely on type casting by `result.column_types`, now the adapter can return numeric value without type casting by Active Record side. So we can remove that useless type cast on aggregated value.
-
由 Ryuta Kamizono 提交于
Actually SQLite3 doesn't have a limitation for identifier name length, so do not need `- 2` margin internally to perform temporary rename operations.
-
由 George Claghorn 提交于
This reverts commit 43503bdf.
-
由 Brendan Abbott 提交于
-
由 Mikel Kew 提交于
-
由 Rafael França 提交于
Remove confusing json by default from testing guide
-
由 danieldimitrov 提交于
-
由 danieldimitrov 提交于
-
- 28 4月, 2020 2 次提交
-
-
由 Ryuta Kamizono 提交于
```ruby class Post < ActiveRecord::Base end posts = Post.where(id: 1, title: "foo") Benchmark.ips do |x| x.report("scope_for_create") { posts.scope_for_create } end ``` Before: ``` Warming up -------------------------------------- scope_for_create 30.125k i/100ms Calculating ------------------------------------- scope_for_create 334.033k (± 4.4%) i/s - 1.687M in 5.060493s ``` After: ``` Warming up -------------------------------------- scope_for_create 35.088k i/100ms Calculating ------------------------------------- scope_for_create 388.603k (±11.8%) i/s - 1.930M in 5.080998s ```
-
由 Ryuta Kamizono 提交于
Define `value_for_database` and `value_before_type_cast` methods, and use those.
-
- 27 4月, 2020 11 次提交
-
-
由 Eileen M. Uchitelle 提交于
check for metadata table support
-
由 Abhay Nikam 提交于
-
由 Ryuta Kamizono 提交于
This is required for #39063 to use `PG::TextDecoder::Numeric`. Ref https://github.com/ged/ruby-pg/pull/25. The pg gem 1.1.0 was released at August 24, 2018, so I think it is good timing to bump the required version for improving and cleaning up the code base. https://rubygems.org/gems/pg/versions
-
由 Ryuta Kamizono 提交于
Deprecate `in_clause_length` in `DatabaseLimits`
-
由 Ryuta Kamizono 提交于
-
由 Ryuta Kamizono 提交于
Remove redundant begin block from yarn template
-
由 Tasos Latsas 提交于
-
由 Ryuta Kamizono 提交于
This reverts commit 960ceb23. Ref #39012, #38858. [ci skip]
-
由 Xavier Noria 提交于
Require time core extensions in all environments
-
由 Eugene Kenny 提交于
These have been required in the generated test environment config since 1c7207a2, but the generated development config also uses them (albeit inside a conditional), and the generated production config contains a comment which uses them. More generally, we shouldn't require core extensions in one environment and not others, since applications with `config.active_support.bare` enabled could rely on them implicitly and exhibit inconsistent behaviour across environments.
-
由 Ryuta Kamizono 提交于
`in_clause_length` was added at c5a284f8 to address to Oracle IN clause length limitation. Now `in_clause_length` is entirely integrated in Arel visitor since #35838 and #36074. Since Oracle visitors are the only code that rely on `in_clause_length`. so I'd like to remove that from Rails code base, like has removed Oracle visitors (#38946).
-
- 26 4月, 2020 3 次提交
-
-
由 Ryuta Kamizono 提交于
Improve `WhereClause#ast` to make concise Arel ast
-
由 Ryuta Kamizono 提交于
Fix aggregate functions to return numeric value consistently even on custom attribute type
-
由 Ryuta Kamizono 提交于
Merge pull request #39048 from abhaynikam/fix-failing-test-for-upsert-all-on-relation-for-sqlite-adapter Skip test cases for upsert_all on relation for sqlite adapter for duplicate record
-
- 25 4月, 2020 1 次提交
-
-
由 Abhay Nikam 提交于
Skip test cases for upsert_all on relation if database adapter doesn't support update on duplicate records
-