| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
Remove duplicated `unless current_adapter?(:SQLite3Adapter)` condition
|
| |
| |
| |
| |
| |
| | |
`test_native_decimal_insert_manual_vs_automatic` exists inside
`unless current_adapter?(:SQLite3Adapter)`. This condition is
duplicated.
|
|/ |
|
|
|
|
|
|
| |
assert [1, 3].includes?(2) fails with unhelpful "Asserting failed" message
assert_includes [1, 3], 2 fails with "Expected [1, 3] to include 2" which makes it easier to debug and more obvious what went wrong
|
|
|
|
| |
The `elsif` branch is completely duplicated with `else` branch.
|
| |
|
|
|
|
|
|
|
|
| |
Style/SpaceBeforeBlockBraces
Style/SpaceInsideBlockBraces
Style/SpaceInsideHashLiteralBraces
Fix all violations in the repository.
|
|
|
|
| |
Some case expressions remain, need to think about those ones.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
|
|
|
|
|
| |
- Refer https://github.com/rsim/oracle-enhanced/pull/845
Remove `set_date_columns` which has been deprecated in Oracle enhanced adapter
- Refer https://github.com/rsim/oracle-enhanced/pull/869
|
|
|
|
| |
- Followup of https://github.com/rails/rails/pull/23179
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If you had a foreign key set and then decided to add `on_delete:
:cascade` later in another migration that migration would run but
wouldn't refresh the schema dump.
The reason for this was because `create_table_info` caches the statement
and sets it to be the same as the original declaration for the foreign
key (without the `on_delete: :cascade`.
PR #25307 ended up fixing this bug because it removes the check for
`create_table_info` and relies on reading from `information_schema`. The
fix however was intended to patch another bug. The reason this fixes the
issue is we're no longer parsing the regex from the cached
`create_table_info`.
This regression test is to ensure that the issue does not return if we
for some reason go back to using `create_table_info` to set the foreign
keys.
|
|
|
|
|
|
|
|
| |
Ruby 2.4 unifies Fixnum and Bignum into Integer: https://bugs.ruby-lang.org/issues/12005
* Forward compat with new unified Integer class in Ruby 2.4+.
* Backward compat with separate Fixnum/Bignum in Ruby 2.2 & 2.3.
* Drops needless Fixnum distinction in docs, preferring Integer.
|
|\
| |
| | |
create_join_table should work with uuid
|
| | |
|
| | |
|
|/ |
|
|\
| |
| |
| |
| | |
prathamesh-sonpatki/fix-showing-of-deprecation-warning-for-legacy-migrations
Correctly show deprecation warning for incompatible migrations
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Tests on Travis are randomly failing because schema_migrations table
does not exist in teardown block.
- Also checked that all other places where we have used
`ActiveRecord::SchemaMigration.delete_all` we have rescued it, so used
it here also. This failure was not specifically related to the test
added in this PR but to overall compatibility migration tests, so
adding as separate commit.
|
| | |
|
|\ \
| |/
|/|
| |
| |
| |
| | |
Let t.foreign_key use the same `to_table` twice
Conflicts:
activerecord/CHANGELOG.md
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously if you used `t.foreign_key` twice within the same
`create_table` block using the same `to_table`, all statements except
the final one would fail silently. For example, the following code:
def change
create_table :flights do |t|
t.integer :from_id, index: true, null: false
t.integer :to_id, index: true, null: false
t.foreign_key :airports, column: :from_id
t.foreign_key :airports, column: :to_id
end
end
Would only create one foreign key, on the column `from_id`.
This commit allows multiple foreign keys to the same table to be created
within one `create_table` block.
|
|\
| |
| | |
Make to primary key instead of an unique index for internal tables
|
| | |
|
|/ |
|
|
|
|
|
|
|
|
|
|
| |
- Using `references` or `belongs_to` in migrations will always add index
for the referenced column by default, without adding `index:true` option
to generated migration file.
- Users can opt out of this by passing `index: false`.
- Legacy migrations won't be affected by this change. They will continue
to run as they were before.
- Fixes #18146
|
| |
|
|
|
|
|
|
|
| |
uuid-ossp extension is alreadly enabled on test schema.
And `disable_extension!('uuid-ossp', connection)` can be a cause of test failure.
`ActiveRecord::StatementInvalid: PG::UndefinedFunction: ERROR: function uuid_generate_v1() does not exist`
will happen depending on the execution order.
|
|
|
|
| |
Follow up to #22642.
|
|\
| |
| |
| | |
Ignore index name in `index_exists?` when not passed a name to check for
|
| | |
|
| | |
|
|/ |
|
|
|
|
|
|
|
|
| |
Apart from specific versioning support, our tests should focus on the
behaviour of whatever version they're accompanying, regardless of when
they were written.
Application code should *not* do this.
|
|
|
|
| |
`adapters/postgresql/geometric_test.rb`
|
|
|
|
|
|
|
|
|
|
| |
Reported on #21509, how views is treated by `#tables` are differ
by each adapters. To fix this different behavior, after Rails 5.0
is released, deprecate `#tables`.
And `#table_exists?` would check both tables and views.
To make their behavior consistent with `#tables`, after Rails 5.0
is released, deprecate `#table_exists?`.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Closes #21563.
The `name` argument of `add_references` was both used to generate the
column name `<name>_id` and as the target table for the foreign key
`name.pluralize`.
It's primary purpose is to define the column name. In cases where the
`to_table` of the foreign key is different than the column name we
should be able to specify it individually.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If foreign keys specified in create table, generated SQL is slightly more
efficient.
Definition:
```
create_table :testings do |t|
t.references :testing_parent, foreign_key: true
end
```
Before:
```
CREATE TABLE "testings" ("id" serial primary key, "testing_parent_id" integer);
ALTER TABLE "testings" ADD CONSTRAINT "fk_rails_a196c353b2" FOREIGN KEY ("testing_parent_id") REFERENCES "testing_parents" ("id");
```
After:
```
CREATE TABLE "testings" ("id" serial primary key, "testing_parent_id" integer, CONSTRAINT "fk_rails_a196c353b2" FOREIGN KEY ("testing_parent_id") REFERENCES "testing_parents" ("id"));
```
|
| |
|
| |
|
|\ |
|
| | |
|
|\ \
| | |
| | |
| | |
| | | |
vngrs/foreign_key_with_table_name_suffix_and_prefix
Add table name prefix and suffix support for foreign keys
|