| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
PostgreSQL: Fix db:structure:load silent failure on SQL error
|
| |
| |
| |
| |
| |
| |
| |
| | |
The command line flag "-v ON_ERROR_STOP=1" should be used when invoking psql to make sure errors are not suppressed.
Example: psql -v ON_ERROR_STOP=1 -q -f awesome-file.sql my-app-db
Fixes #23818.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This behavior was broken by 36e9be85. When the value is assigned
directly, either through mass assignment or directly assigning a hash,
the hash gets passed through to this writer method directly. While this
is intended to handle certain cases, when an explicit converter has been
provided, we should continue to use that instead. The positioning of the
added guard caused the new behavior to override that case.
Fixes #25210
|
|\ \
| | |
| | | |
Introduce AR::TransactionSerializationError for transaction serialization failures or deadlocks
|
| | |
| | |
| | |
| | | |
or deadlocks
|
| | | |
|
|/ /
| |
| |
| |
| |
| |
| | |
Sorry for forgetting to include it in my original PR :grimacing:
r? @rafaelfranca
[ci skip]
|
|\ \
| |/
|/|
| | |
Fix bug in JSON deserialization when column default is an empty string
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When `ActiveRecord::Coders::JSON` serialization is used and the default of the column returns `''` it raises the following error:
```
JSON::ParserError: A JSON text must at least contain two octets!
```
If MySQL is running in non-strict mode, it returns an empty string as column default for a text column:
```ruby
def extract_default
if blob_or_text_column?
@default = null || strict ? nil : ''
end
end
```
Since `''` is invalid JSON, there shouldn't be an attempt to parse it, it should be treated like nil.
ActiveRecord::Coders::JSON should behave consistently for all possible non-user-set column default values.
|
| | |
|
| | |
|
| |
| |
| |
| | |
Follow up to 98264a1343fad6bb6637893a37fd571916b4158c
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
|\ \
| | |
| | |
| | | |
Add prepared statements support for `Mysql2Adapter`
|
|/ / |
|
|\ \
| | |
| | |
| | |
| | |
| | | |
kamipo/dump_indexes_in_create_for_generates_sql_in_one_query
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.
|
|\ \
| | |
| | |
| | | |
Avoid a string value truncation in uniqueness validation
|
|\ \ \
| | | |
| | | |
| | | | |
Add `ActiveRecord::ValueTooLong` exception class
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
kamipo/foreign_key_respects_table_name_prefix_and_suffix
`foreign_key` respects `table_name_prefix` and `table_name_suffix`
|
|\ \ \ \
| | | | |
| | | | |
| | | | | |
Primary key should be `NOT NULL`
|
| | | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Added notice when a database is successfully created or dropped.
|
| | | | | | |
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | |
| | | | | | | |
Add support for specifying comments for tables, columns, and indexes in database itself
|
|/ / / / / /
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Comments are specified in migrations, stored in database itself (in its schema),
and dumped into db/schema.rb file.
This allows to generate good documentation and explain columns and tables' purpose
to everyone from new developers to database administrators.
For PostgreSQL and MySQL only. SQLite does not support comments at the moment.
See docs for PostgreSQL: http://www.postgresql.org/docs/current/static/sql-comment.html
See docs for MySQL: http://dev.mysql.com/doc/refman/5.7/en/create-table.html
|
|/ / / / /
| | | | |
| | | | |
| | | | | |
[ci skip]
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Previously we were assuming that the only valid types for encoding were
arrays and hashes. However, any JSON primitive is an accepted value by
both PG and MySQL.
This does involve a minor breaking change in the handling of `default`
in the schema dumper. This is easily worked around, as passing a
hash/array literal would have worked fine in previous versions of Rails.
However, because of this, I will not be backporting this to 4.2 or
earlier.
Fixes #24234
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
We support microsecond datetime precision for MySQL 5.6.4+. MariaDB has
supported it since 5.3.0, but even 10.x versions return a compatible
version string like `5.5.5-10.1.8-MariaDB-log` which we parse as 5.5.5,
before MySQL supported microsecond precision.
Specialize our version check to account for MariaDB to fix.
|
| | | | |
| | | | |
| | | | |
| | | | | |
The option backed to `start` in da26934313a31ae530b7537aba8a7662152f4dfe.
|
| | | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Add changelog for #24305
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Forgot to add, sigh.
Closes #24273
|
|/ / / / / |
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
When a proc is given as a default value, the form builder ends up
displaying `Proc#to_s` when the default is used. That's because we
didn't handle the proc until type casting. This issue technically can
occur any time that a proc is the value before type casting, but in
reality the only place that will occur is when a proc default is
provided through the attributes API, so the best place to handle this
edge case is there.
I've opted to memoize instead of just moving the `Proc#call` up, as this
made me realize that it could potentially interact very poorly with
dirty checking.
The code here is a little redundant, but I don't want to rely on how
`value_before_type_cast` is implemented in the super class, even if it's
just an `attr_reader`.
Fixes #24249
Close #24306
|
|\| | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
kamipo/append_sql_mode_instead_of_overwriting_in_strict_mode
Append sql_mode instead of overwriting in strict mode
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
[ci skip]
Sync AV, AR, AJ, AS, AM changelogs with our 5.0 release notes draft.
This is a follow up to c94045d and contains changes made since the
release of beta1.
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
related to #19324 and #18606
[skip ci]
|
| | | | |
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Closes #23934.
This is a forward port of ac832a43b4d026dbad28fed196d2de69ec9928ac
Previously the scope of all associations with extensions were wrapped in
an instance dependent proc. This made it impossible to preload such
associations.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Originally, `{insert|update|delete}_sql` is protected methods.
We can use the `{insert|update|delete}` public methods instead.
|
|\ \ \ \
| | | | |
| | | | |
| | | | | |
Add option to error on ignored order or limit
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
ignored in batches
add some documentation and add 4 tests regarding error vs. warning behavior
fix a typo when referring to the message
go back to default in tests so that ordering is not important. use a constant instead of method. fix assert_nothing_raised call. use self.klass to allow per class configuration
remove logger warn assets as that is tested elsewhere. pass error_on_ignore through find_each and find_in_batches also.
add blocks to the finds so that the code is actually executed
put the setting back to default in an ensure
Add a changelog entry
|
|\ \ \ \ \
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Honour joining model order in `has_many :through` associations when
eager loading
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
association when eager loading.
Previously, eager loading a `has_many :through` association with no
defined order would return the records in the natural order of the
database. Now, these records will be returned in the order that the
joining record is returned, in case there is a defined order there.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
I ran into an issue where validations on a suppressed record were
causing validation errors to be thrown on a record that was never going
to be saved.
There isn't a reason to run the validations on a record that doesn't
matter.
This change moves the suppressor up the chain to be run on the `save` or
`save!` in the validations rather than in persistence. The issue with
running it when we hit persistence is that the validations are run
first, then we hit persistance, and then we hit the suppressor. The
suppressor comes first.
The change to the test was required since I added the
`validates_presence_of` validations. Adding this alone was enough to
demonstrate the issue. I added a new test to demonstrate the new
behavior is explict.
|