Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLite3: Implement `add_foreign_key` and `remove_foreign_key` #35212

Merged
merged 2 commits into from Feb 11, 2019

Conversation

@kamipo
Copy link
Member

commented Feb 10, 2019

I implemented Foreign key create in create_table for SQLite3 at
#24743. This follows #24743 to implement add_foreign_key and
remove_foreign_key.
Unfortunately SQLite3 has one limitation that
PRAGMA foreign_key_list(table-name) doesn't have constraint name.
So we couldn't implement find/remove foreign key by name for now.

Fixes #35207.
Closes #31343.

@kamipo kamipo force-pushed the kamipo:sqlite3_foreign_key branch 2 times, most recently from 5029f8c to 6b2623d Feb 10, 2019
I implemented Foreign key create in `create_table` for SQLite3 at
#24743. This follows #24743 to implement `add_foreign_key` and
`remove_foreign_key`.
Unfortunately SQLite3 has one limitation that
`PRAGMA foreign_key_list(table-name)` doesn't have constraint name.
So we couldn't implement find/remove foreign key by name for now.

Fixes #35207.
Closes #31343.
@kamipo kamipo force-pushed the kamipo:sqlite3_foreign_key branch from 6b2623d to da58434 Feb 11, 2019
This reverts commit 141f50e, reversing
changes made to 317efa5.

Reason: `add_foreign_key` and `remove_foreign_key` are implemented at
#35212.

[ci skip]
@rails-bot rails-bot bot added the docs label Feb 11, 2019
@kamipo kamipo merged commit 825d70b into rails:master Feb 11, 2019
1 check passed
1 check passed
codeclimate All good!
Details
@kamipo kamipo deleted the kamipo:sqlite3_foreign_key branch Feb 11, 2019
koic added a commit to koic/oracle-enhanced that referenced this pull request Feb 13, 2019
…s_in_create?`

Follow up of rails/rails#35212.

This PR fixes the following error.

```console
$ bundle exec rspec ./spec/active_record/connection_adapters/oracle_enhanced/connection_spec.rb:179

(snip)

Failures:

  1) OracleEnhancedConnection default_timezone should respect
  default_timezone = :utc than time_zone setting
     Failure/Error: if supports_foreign_keys_in_create?

     NoMethodError:
       undefined method `supports_foreign_keys_in_create?' for
       #<ActiveRecord::ConnectionAdapters::OracleEnhanced::SchemaCreation:0x0000000003ef9108>
       Did you mean?  supports_foreign_keys?
     # ./lib/active_record/connection_adapters/oracle_enhanced/schema_creation.rb:24:in `visit_TableDefinition'
     # /home/vagrant/.rvm/gems/ruby-2.6.0/bundler/gems/rails-8d9d46fdae45/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb:14:in `accept'
     # ./lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb:233:in `create_table'
```

https://travis-ci.org/rsim/oracle-enhanced/jobs/492524301#L932
@bogdanvlviv

This comment has been minimized.

Copy link
Contributor

commented Feb 15, 2019

That's great! Can we add changelog entry about this change?

@kamipo

This comment has been minimized.

Copy link
Member Author

commented Feb 16, 2019

👍 Added 850e6aa

kamipo added a commit that referenced this pull request Feb 16, 2019
kamipo added a commit that referenced this pull request Feb 16, 2019
Since #35212, foreign key feature is supported by all adapters.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.