| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
|
| |
`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
|
|
|
|
|
|
| |
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
|
|
|
|
| |
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.
|
|\
| |
| | |
Use ensure block for things we cleanup in tests
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
primary_keys(table) needs to query various metadata tables in Postgres
to determine the primary key for the table. Previously, it did so using
a complex common table expression against pg_constraint and
pg_attribute.
This patch simplifies the query by using information_schema tables.
This simplifies the logic, making the query far easier to understand,
and additionally avoids an expensive unnest, window function query, and
common table expression.
|
|\ \
| | |
| | | |
Fix `remove_index` to be able to remove expression indexes
|
| | |
| | |
| | |
| | | |
Fixes #26635, #26641.
|
| | |
| | |
| | |
| | |
| | |
| | | |
The `default` arg of `index_name_exists?` is only used the adapter does
not implemented `indexes`. But currently all adapters implemented
`indexes` (See #26688). Therefore the `default` arg is never used.
|
| | |
| | |
| | |
| | | |
Closes #27980
|
| | |
| | |
| | |
| | | |
Closes #27979
|
| | |
| | |
| | |
| | | |
empty lines
|
| | |
| | |
| | |
| | |
| | |
| | | |
Column options are passed as an hash args then used as `options` hash in
`add_column_options!`. Converting args to attributes is inconvinient for
using options as an hash.
|
| |/
|/|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The PR #27384 changed migration compatibility behaviour.
```ruby
class CreateMasterData < ActiveRecord::Migration[5.0]
def change
create_table :master_data, id: :integer do |t|
t.string :name
end
end
end
```
Previously this migration created non-autoincremental primary key
expected. But after the PR, the primary key changed to autoincremental,
it is unexpected.
This change restores the behaviour of the compatibility layer.
|
| |
| |
| |
| |
| | |
This message could be generated by `assert_predicate`, https://github.com/rails/rails/commit/1853a4f2c8b2bddfbde6aae80abb08310295201c#commitcomment-20546113
but I'd rather handwrite the message string if I could reduce magic from the code by doing so.
|
| | |
|
|\ \
| | |
| | | |
Fix UUID primary key with default nil in legacy migration
|
| | |
| | |
| | |
| | |
| | |
| | | |
UUID primary key with no default value feature (#10404, #18206) was lost
in legacy migration caused by #25395 got merged. Restore the feature
again in legacy migration.
|
| | | |
|
|/ /
| |
| |
| | |
(I personally prefer writing one string in one line no matter how long it is, though)
|