| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
Make `type_map` to private because it is only used in the connection adapter
|
| |
| |
| |
| |
| |
| |
| | |
`type_map` is an internal API and it is only used in the connection
adapter. And also, some type map initializer methods requires passed
`type_map`, but those instances already has `type_map` in itself.
So we don't need explicit passing `type_map` to the initializers.
|
|\ \
| | |
| | | |
Use frozen-string-literal in ActiveRecord
|
| |/ |
|
|/
|
|
|
|
|
|
| |
This reverts commit b6ad4052d18e4b29b8a092526c2beef013e2bf4f.
This is not something that the majority of Active Record should be
testing or care about. We should look at having fewer places rely on
these details, not make it easier to rely on them.
|
|\
| |
| | |
Make preload query to preparable
|
| |
| |
| |
| |
| |
| |
| | |
Currently preload query cannot be prepared statements even if
`prepared_statements: true` due to array handler in predicate builder
doesn't support making bind params. This makes preload query to
preparable by don't passing array value if possible.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Abstract boolean serialization has been using 't' and 'f', with MySQL
overriding that to use 1 and 0.
This has the advantage that SQLite natively recognizes 1 and 0 as true
and false, but does not natively recognize 't' and 'f'.
This change in serialization requires a migration of stored boolean data
for SQLite databases, so it's implemented behind a configuration flag
whose default false value is deprecated. The flag itself can be
deprecated in a future version of Rails. While loaded models will give
the correct result for boolean columns without migrating old data,
where() clauses will interact incorrectly with old data.
While working in this area, also change the abstract adapter to use
`"TRUE"` and `"FALSE"` as quoted values and `true` and `false` for
unquoted. These are supported by PostreSQL, and MySQL remains
overriden.
|
|\ \
| | |
| | | |
Don't allow uuids with orphan curly braces
|
| |/
| |
| |
| |
| |
| |
| |
| | |
The uuid validation regex was allowing uuids to have a single leading
curly brace or single trailing curly brace. Saving with such a uuid
would cause Postgres to generate an exception even though the record
seemed valid. With this change, the regex requires both a leading *and*
a trailing curly brace or neither to be valid.
|
|/
|
|
|
|
| |
Since MariaDB 10.2.5, `information_schema` supports Virtual Columns.
Fixes #29670.
|
|
|
|
|
| |
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
|
|\
| |
| |
| | |
Enforce frozen string in Rubocop
|
| | |
|
|\ \
| |/
|/|
| | |
Make ActiveSupport frozen-string-literal friendly.
|
| | |
|
|/
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
Running `bin/test` from the activerecord directory produces this error:
test/cases/adapters/postgresql/uuid_test.rb:43:in `<class:PostgresqlUUIDTest>': undefined method `supports_pgcrypto_uuid?' for #<ActiveRecord::ConnectionAdapters::SQLite3Adapter:0x007fc405e72a68> (NoMethodError)
The test only actually runs on the PostgreSQL adapter; we can avoid
triggering the error on other adapters with this `respond_to?` guard.
|
|\
| |
| | |
PostgreSQL 10 converts unknown type to text type
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Rename test cases from `unknown` to `unrecognized` since unknown OID
is one of possible unrecognized types by Rails
- Use "select 'pg_catalog.pg_class'::regclass" whose OID is 2205, which
will not be converted to recognized type in PostgreSQL 10.
activerecord_unittest=# select oid, typname from pg_type where oid in (2205, 2277);
oid | typname
------+----------
2205 | regclass
2277 | anyarray
(2 rows)
Addresses #28868
|
|/
|
|
| |
These `assert_nothing_raised` are covered by following assertions.
|
|
|
|
|
| |
`ReservedWordTest` expects that any identifiers are quoted properly.
It should be tested for all adapters.
|
| |
|
| |
|
|
|
|
|
|
|
| |
`quote_default_expression` can be passed nil value when `null: true` and
`default: nil`. This addressed in that case.
Fixes #29222.
|
| |
|
|\
| |
| | |
Define path with __dir__
|
| |
| |
| |
| |
| |
| | |
".. with __dir__ we can restore order in the Universe." - by @fxn
Related to 5b8738c2df003a96f0e490c43559747618d10f5f
|
| | |
|
|/
|
|
|
| |
Both `mysql2/json_test.rb` and `postgresql/json_test.rb` have same test
cases.
|
| |
|
|
|
|
| |
These are used in tests from anywhere.
|
|
|
|
|
|
|
|
|
| |
mtsmfm/disable-referential-integrity-without-superuser-privilege-take-2"
This reverts commit c1faca6333abe4b938b98fedc8d1f47b88209ecf, reversing
changes made to 8c658a0ecc7f2b5fc015d424baf9edf6f3eb2b0b.
See https://github.com/rails/rails/pull/27636#issuecomment-297534129
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`internal_string_options_for_primary_key` is used for creating internal
tables in newly apps. But it is no longer needed after MySQL 8.0.0.
MySQL 5.7 has introduced `innodb_default_row_format` (default `DYNAMIC`)
and has deprecated `innodb_large_prefix` and `innodb_file_format`.
The purpose of the deprecated options was for compatibility with earlier
versions of InnoDB.
https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_large_prefix
> innodb_large_prefix is deprecated and will be removed in a future
release. innodb_large_prefix was introduced in MySQL 5.5 to disable
large index key prefixes for compatibility with earlier versions of
InnoDB that do not support large index key prefixes.
https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_file_format
> The innodb_file_format option is deprecated and will be removed in a
future release. The purpose of the innodb_file_format option was to
allow users to downgrade to the built-in version of InnoDB in MySQL 5.1.
Now that MySQL 5.1 has reached the end of its product lifecycle,
downgrade support provided by this option is no longer necessary.
The deprecated options has removed in MySQL 8.0.0. It is no longer
needed to take care newly created internal tables as a legacy format
after MySQL 8.0.0.
Fixes #28730.
|
|
|
|
|
|
| |
Also, explicitly apply the order: generate_subscripts is unlikely to
start returning values out of order, but we should still be clear about
what we want.
|
| |
|
|\
| |
| | |
Fix `primary_keys` across multiple schemas
|
| |
| |
| |
| | |
Fixes #28470.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
privileges (take 2)
Re-create https://github.com/rails/rails/pull/21233
eeac6151a5 was reverted (127509c071b4) because it breaks tests.
----------------
ref: 72c1557254
- We must use `authors` fixture with `author_addresses` because of its foreign key constraint.
- Tests require PostgreSQL >= 9.4.2 because it had a bug about `ALTER CONSTRAINTS` and fixed in 9.4.2.
|
|\ \
| | |
| | | |
Suppress `WARNING: nonstandard use of \\ in a string literal` warning
|
| |/
| |
| |
| | |
by setting `escape_string_warning = off`
|
|/
|
|
|
| |
The old top level classes PGconn, PGresult and PGError were deprecated
since pg-0.13.0: https://github.com/ged/ruby-pg/blob/master/History.rdoc#v0130-2012-02-09-michael-granger-gedfaeriemudorg
|
|\
| |
| | |
Extract `data_source_sql` to refactor data source statements
|
| | |
|
| |
| |
| |
| | |
Fixes #28285.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`valid_type?` is used in schema dumper to determine if a type is
supported. So if `valid_type?(:foobar)` is true, it means that schema
dumper is allowed to create `t.foobar`. But it doesn't work. I think
that `valid_type?` should accept only supported types.
https://github.com/rails/rails/blob/v5.1.0.beta1/activerecord/lib/active_record/schema_dumper.rb#L135-L142
```ruby
columns.each do |column|
raise StandardError, "Unknown type '#{column.sql_type}' for column '#{column.name}'" unless @connection.valid_type?(column.type)
next if column.name == pk
type, colspec = @connection.column_spec(column)
tbl.print " t.#{type} #{column.name.inspect}"
tbl.print ", #{format_colspec(colspec)}" if colspec.present?
tbl.puts
end
```
|
| |
| |
| |
| |
| | |
Actually `index_name_length` depend on `max_identifier_length`, not
always 63.
|
|\ \
| | |
| | | |
Deprecate AbstractAdapter#verify! with arguments
|
| | | |
|
|\ \ \
| | | |
| | | | |
Use ensure block for things we cleanup in tests
|