| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
`ActiveRecord::Persistence#touch` does not work well when optimistic
locking enabled and `locking_column`, without default value, is null in
the database.
|
|
|
|
|
|
|
| |
Fix destroying existing object does not work well when optimistic
locking enabled and `locking column` is null in the database.
Follow 22a822e5813ef7ea9ab6dbbb670a363899a083af, #28914
|
|
|
|
|
|
|
|
| |
Improves the performance from O(n) to O(1).
Previously it would require 50 queries to
insert 50 fixtures. Now it takes only one query.
Disabled on sqlite which doesn't support multiple inserts.
|
|
|
|
|
|
|
|
| |
If casted value is nil, generated SQL should be `IS NULL`. But currently
it is generated as `= NULL`. To prevent this behavior, avoid making bind
param if casted value is nil.
Fixes #28945.
|
|
|
|
|
|
|
|
| |
in `ActiveRecord::Calculations`
`select`, `count`, and `sum` in `Relation` are also `Enumerable` method
that can be passed block. `select` with block already doesn't take
arguments since 4fc3366. This is follow up of that.
|
|
|
|
| |
[Vikrant Chaudhary, David Abdemoulaie, Matthew Draper]
|
|
|
|
|
| |
* Fix indentation.
* Add backticks.
|
| |
|
| |
|
|
|
|
|
| |
Since we have been using this `Arel::Table` since 111ccc832bc977b15af12c14e7ca078dad2d4373,
in order to properly handle queries, it's important that we properly type cast arguments.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`supports_statement_cache?` was introduced in 3.1.0.beta1 (104d0b2) for
bind parameter substitution, but it is no longer used in 3.1.0.rc1
(73ff679). Originally it should respect `prepared_statements` rather
than `supports_statement_cache?` (fd39847).
One more thing, named `supports_statement_cache?` is pretty misreading.
We have `StatementCache` and `StatementPool`. However,
`supports_statement_cache?` doesn't mean `StatementCache`, but
`StatementPool` unlike its name.
https://github.com/rails/rails/blob/v5.1.0/activerecord/lib/active_record/statement_cache.rb
https://github.com/rails/rails/blob/v5.1.0/activerecord/lib/active_record/connection_adapters/statement_pool.rb
|
|
|
|
|
|
| |
* Remove trailing spaces.
* Add backticks around method and command.
* Fix indentation.
|
|\
| |
| |
| | |
Fix quoting in db:create grant all statement.
|
| |
| |
| |
| |
| |
| | |
The database name used in the test would have actually shown this if it
had tried to execute on a real Mysql instead of being stubbed out
(dashes in database names needs quotes).
|
| |
| |
| |
| |
| | |
Raise error on the movement of migrations
when the current migration does not exist.
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
MySQL 8.0.1 and higher supports descending indexes: `DESC` in an index
definition is no longer ignored.
See https://dev.mysql.com/doc/refman/8.0/en/descending-indexes.html.
|
| | |
|
|/
|
|
| |
fixtures, not an empty array.
|
|
|
|
|
|
|
| |
This CHANGELOG.md is a continuation of the 5-1-stable one, there
shouldn't be any duplicate entries.
[ci skip]
|
|
|
|
|
|
|
| |
Instead of loading all records and returning only a subset of those,
just load the records as needed.
Fixes #25537.
|
| |
|
|
|
|
|
| |
`ActiveRecord::TransactionSerializationError` was introduces in #25093.
However, refactored in #25107, `TransactionSerializationError` is gone.
|
|\
| |
| |
| | |
Drop comments from structure.sql in postgresql
|
| |
| |
| |
| | |
Fixes #28153.
|
|\ \
| | |
| | |
| | |
| | | |
bogdanvlviv/remove-ability-update-locking_column-value
Remove ability update locking_column value
|
| | | |
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Use it to specify that an association should be initialized with a
particular record before validation. For example:
# Before
belongs_to :account
before_validation -> { self.account ||= Current.account }
# After
belongs_to :account, default: -> { Current.account }
|
| | |
|
|\ \
| | |
| | |
| | | |
Deprecate `Migrator.schema_migrations_table_name`
|
| | |
| | |
| | |
| | |
| | | |
Since 67fba0cf `SchemaMigration` model was extracted.
Use `SchemaMigration.table_name` instead.
|
|/ /
| |
| |
| |
| |
| |
| |
| | |
The `select` in `QueryMethods` is also an enumerable method.
Enumerable methods with block should delegate to `records` on
`CollectionProxy`, not `scope`.
Fixes #28348.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In #27674 we changed the migration generator to generate migrations at
the path defined in `Rails.application.config.paths` however the code
checked for the presence of the `Rails` constant but not the
`Rails.application` method which caused problems when using Active
Record and generators outside of the context of a Rails application.
Fixes #28325.
|
| |
| |
| |
| | |
Fixes #28285.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Related #25174.
`db:schema:load` doesn't work with subdirectories like previous
`db:migrate:status`. `Migrator.migration_files` should be used in
`assume_migrated_upto_version` to fix the issue.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`db:migrate` supports subdirectories and have a test.
https://github.com/rails/rails/blob/v5.1.0.beta1/activerecord/test/cases/migrator_test.rb#L78-L85
But `db:migrate:status` doesn't work with subdirectories. It is due to
`Dir.foreach(path)` is not the same with `Dir["#{path}/**/[0-9]*_*.rb"]`.
I extracted `migration_files` and sharing it in the both to fix the
issue. And added tests for `db:migrate:status`.
|
| | |
|
| |
| |
| |
| |
| | |
Actually `index_name_length` depend on `max_identifier_length`, not
always 63.
|
| |
| |
| |
| |
| |
| |
| | |
`supports_migrations?` was added at 4160b518 to determine if schema
statements (`create_table`, `drop_table`, etc) are implemented in the
adapter. But all tested databases has been supported migrations since
a4fc93c3 at least.
|
|/ |
|
|
|
|
|
| |
Originally `quoted_id` was used in legacy quoting mechanism. Now we use
type casting mechanism for that. Let's deprecate `quoted_id`.
|
|
|
|
| |
Fixes #26556.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The native timestamp type in MySQL is different from datetime type.
Internal representation of the timestamp type is UNIX time, This means
that timestamp columns are affected by time zone.
```
> SET time_zone = '+00:00';
Query OK, 0 rows affected (0.00 sec)
> INSERT INTO time_with_zone(ts,dt) VALUES (NOW(),NOW());
Query OK, 1 row affected (0.02 sec)
> SELECT * FROM time_with_zone;
+---------------------+---------------------+
| ts | dt |
+---------------------+---------------------+
| 2016-02-07 22:11:44 | 2016-02-07 22:11:44 |
+---------------------+---------------------+
1 row in set (0.00 sec)
> SET time_zone = '-08:00';
Query OK, 0 rows affected (0.00 sec)
> SELECT * FROM time_with_zone;
+---------------------+---------------------+
| ts | dt |
+---------------------+---------------------+
| 2016-02-07 14:11:44 | 2016-02-07 22:11:44 |
+---------------------+---------------------+
1 row in set (0.00 sec)
```
|
|\
| |
| | |
Add CHANGELOG entry for #27384 and #27762
|
| | |
|
|/
|
|
| |
[ci skip]
|
| |
|
| |
|
|
|
|
| |
Closes #27980
|