| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
| |
There are some minor changes to the point type as I had forgotten that
this will affect the behavior of `t.point` in migrations and the schema
dumper so we need to handle those as well.
I'll say this again so I can convince myself to come up with a better
structure... TYPES SHOULD NOT CARE ABOUT SCHEMA DUMPING AND WE NEED TO
BETTER SEPARATE THESE.
|
|
|
|
|
|
|
|
|
| |
This reverts commit 3a1f6fe7b4a70bf0698b0684dd48ac712c6883b6.
This commit takes the code in a direction that I am looking to avoid.
The predicate builder should be purely concerned with AST construction
as it matters to methods like `where`. Things like case sensitivity
should continue to be handled elsewhere.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I still think that this is something that should be handled in the pg
gem, but it's not going to end up happening there so we'll do it here
instead. Once we bump to pg 0.19 we can pass the encoding to the
`encode` method instead.
This issue occurs because C has no concept of encoding (or strings,
really). The bytes that we pass here when sending the value to the
database will always be interpreted as whatever encoding the connection
is currently configured to use. That means that roundtripping to the
database will lose no information
However, after assigning we round trip through our type system without
hitting the database. The only way that we can do the "correct" thin
here would be to actually give a reference to the connection to the
array type and have it check the current value of the connection's
encoding -- which I'm strongly opposed to. We could also pass in the
encoding when it's constructed, but since that can change independently
of the type I'm not a huge fan of that either.
This feels like a reasonable middle ground, where if we have an array of
strings we simply use the encoding of the string we're given.
Fixes #26326.
|
|
|
|
| |
For reduce instantiating `Type::Value`.
|
|
|
|
| |
Fixes #26137.
|
| |
|
|\
| |
| |
| |
| |
| | |
kamipo/remove_text_default_treated_as_empty_string
Remove text default treated as an empty string in non-strict mode
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Strict mode controls how MySQL handles invalid or missing values in
data-change statements such as INSERT or UPDATE. If strict mode is not
in effect, MySQL inserts adjusted values for invalid or missing values
and produces warnings.
```ruby
def test_mysql_not_null_defaults_non_strict
using_strict(false) do
with_mysql_not_null_table do |klass|
record = klass.new
assert_nil record.non_null_integer
assert_nil record.non_null_string
assert_nil record.non_null_text
assert_nil record.non_null_blob
record.save!
record.reload
assert_equal 0, record.non_null_integer
assert_equal "", record.non_null_string
assert_equal "", record.non_null_text
assert_equal "", record.non_null_blob
end
end
end
```
It is inconsistent with other types that only text/blob defaults treated
as an empty string. This commit fixes the inconsistency.
|
|\ \
| | |
| | | |
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.
|
|\ \
| |/
|/|
| | |
Sqlite3 Migration Error Fixed (issue #26087)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|/
|
|
|
| |
Because `sql_for_insert` is only called in `use_insert_returning?` is
true since #26002.
|
|\
| |
| |
| |
| | |
kamipo/fix_error_message_for_out_of_range_integer_value
Fix error message for out of range byte size integer value for consistency
|
| |
| |
| |
| | |
Related f27a932, #25391.
|
|\ \
| | |
| | |
| | |
| | | |
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`.
|
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | | | | |
|