| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
Fix `primary_keys` across multiple schemas
|
| |
| |
| |
| | |
Fixes #28470.
|
|\ \
| | |
| | | |
Make internal methods to private
|
| | | |
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|/
|
|
|
| |
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
|
| | |
|
| | |
|
|\ \
| | |
| | | |
Suppress deprecation warning `implementing to_yaml is deprecated`
|
| |/ |
|
| |
| |
| |
| | |
Fixes #28285.
|
| |
| |
| |
| |
| | |
Actually `index_name_length` depend on `max_identifier_length`, not
always 63.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently `change_column` cannot drop default if `null: false` is
specified at the same time. This change fixes the issue.
```ruby
# cannot drop default
change_column "tests", "contributor", :boolean, default: nil, null: false
# we need the following workaround currently
change_column "tests", "contributor", :boolean, null: false
change_column "tests", "contributor", :boolean, default: nil
```
Closes #26582
|
|
|
|
|
|
| |
Fixes CI failure caused by #27961.
https://travis-ci.org/rails/rails/jobs/201472146#L2390-L2409
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|\
| |
| | |
The `default` arg of `index_name_exists?` makes to optional
|
| | |
|
| |
| |
| |
| |
| |
| | |
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.
|
|\ \
| |/
|/| |
Extract `quoted_binary` and use it rather than override `_quote`
|
| |
| |
| |
| |
| |
| |
| | |
Each databases have different binary representation. Therefore all
adapters overrides `_quote` for quoting binary.
Extract `quoted_binary` for quoting binary and use it rather than
override `_quote`.
|
| |
| |
| |
| | |
Closes #27980
|
| |
| |
| |
| | |
Closes #27979
|
| |
| |
| |
| | |
This reverts commit d6529af2954a67bd57fda45286fa9cfd0ff6b5ac.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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 joining pg_index against pg_attribute
instead of going through pg_constraint. This avoids an expensive unnest,
window function query, and common table expression.
EXPLAINing these queries in Postgres against a database with a single
table with a composite primary key shows a 66% reduction in the plan and
execute latencies. This is significant during application startup time,
especially against very large schemas, where these queries would be even
slower and more numerous.
Closes #27949
|
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| | |
The PR #27384 changed integer-like primary key to be autoincrement
unless an explicit default. This means that integer-like primary key is
restored as autoincrement unless dumping the default nil explicitly.
We should dump integer-like primary key with default nil correctly.
|
| |
| |
| |
| |
| |
| | |
* Don't force PKs on tables that have explicitly opted out
* All integer-like PKs are autoincrement unless they have an explicit
default
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
mtsmfm/disable-referential-integrity-without-superuser-privileges"
This reverts commit eeac6151a55cb7d5f799e1ae33aa64a839cbc3aa, reversing
changes made to 5c40239d3104543e70508360d27584a3e4dc5baf.
Reason: Broke the isolated tests.
https://travis-ci.org/rails/rails/builds/188721346
|
|\ \
| | |
| | |
| | |
| | | |
mtsmfm/disable-referential-integrity-without-superuser-privileges
Use `SET CONSTRAINTS` for `disable_referential_integrity` without superuser privileges
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
privileges
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.
|
|\ \ \
| | | |
| | | |
| | | |
| | | | |
kamipo/fix_select_rows_method_signature_for_consistency
Fix `select_rows` method signature for consistency
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Related #22973, #24708.
`select_all`, `select_one`, `select_value`, and `select_values` method
signature is `(arel, name = nil, binds = [])`.
But `select_rows` is `(sql, name = nil, binds = [])`.
|
| | | | |
|
|/ / /
| | |
| | |
| | |
| | | |
Passing `name` to `tables` is already deprecated at #21601.
Passing `name` to `indexes` is also unused.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Per the regression commit below, the commit changes the behavior of
`#changed?`to consult the `#changed_in_place?` method on `Type::Value` classes.
Per this change, `PostgreSQL::OID::Hstore` needs to override this method
in order to compare the deserialized forms of the two arguments. In
Ruby, two hashes are considered equal even if their key order is
different. This commit helps to bring that behavior to `Hstore` values.
Fixes regression introduced by 8e633e505880755e7e366ccec2210bbe2b5436e7
Fixes #27502
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
In f1a0fa9 we moved backend specific timestamp behavior out of the type
and into the adapter. This was in line with our general attempt to
reduce the number of adapter specific type subclasses. However, on PG,
the array type performs all serialization, including database encoding
in its serialize method.
This means that we have converted the value into a string before
reaching the database, so no adapter specific logic can be applied (and
this also means that timestamp arrays were using the default `.to_s`
method on the given object, which likely meant timestamps were being
ignored in certain cases as well)
Ultimately I want to do a more in depth refactoring which separates
database serializer objects from the active model type objects, to give
us a less awkward API for introducing the attributes API onto Active
Model.
However, in the short term, we follow the solution we've applied
elsewhere for this. Move behavior off of the type and into the adapter,
and use a data object to allow the type to communicate information up
the stack.
Fixes #27514.
|
| | |
| | |
| | |
| | |
| | | |
Currently schema dumper does not dump array subtype `precision` and
`scale` options. This commit fixes the issue.
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
The visibility of all internal protected methods was changed to private
since 5b14129.
|
| | | |
|
| | | |
|
| | | |
|
|\ \ \
| | | |
| | | | |
Make `:auto_increment` option works on `:bigint`
|
| | | |
| | | |
| | | |
| | | | |
Follow up to #27272.
|
|/ / / |
|
|/ /
| |
| |
| |
| |
| | |
Using `:auto_increment` option for abstracting the DB-specific auto
incremental types. It is worth to ease to implement the compatibility
layer.
|
| |
| |
| |
| |
| |
| |
| | |
- Mentioned clearly that for PostgreSQL < 9.4, you need to pass the
default option with "uuid_generate_v4()"
- Also updated PostgreSQL Active Record guide with this change.
- https://github.com/rails/rails/pull/25395#r66877078
|