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

[BREAKING] Rename :connection configuration option to :db for consistency #650

Merged
merged 1 commit into from
May 30, 2020

Conversation

botandrose
Copy link
Contributor

Renames the :model option, too, which was simply an alias, and shouldn't be in core, anyways, since it was ActiveRecord-specific. Will deprecate that one, too, in v1.99.

Closes #649

With this PR, and the truncation -> deletion renaming PRs in a few of the adapters, I think v2.0 is feature-complete!! I'm hoping to release both v1.99.0.beta and v2.0.0.beta versions of everything this weekend.

Its happening!!

@codecov
Copy link

codecov bot commented May 18, 2020

Codecov Report

Merging #650 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #650   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           19        19           
  Lines          642       642           
=========================================
  Hits           642       642           
Impacted Files Coverage Δ
...es/features/step_definitions/activerecord_steps.rb 100.00% <ø> (ø)
examples/features/step_definitions/redis_steps.rb 100.00% <ø> (ø)
lib/database_cleaner/cleaner.rb 100.00% <100.00%> (ø)
lib/database_cleaner/cleaners.rb 100.00% <100.00%> (ø)
lib/database_cleaner/null_strategy.rb 100.00% <100.00%> (ø)
spec/database_cleaner/cleaner_spec.rb 100.00% <100.00%> (ø)
spec/database_cleaner/cleaners_spec.rb 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 33304de...8829d1b. Read the comment docs.

Copy link
Member

@etagwerker etagwerker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@botandrose This looks good to me, but I wonder if this will cause unexpected consequences for people who are currently using the connection key to specify more than one database.

Would it make sense to break this change into two phases?

Phase 1: Deprecate that option and add a LOUD deprecation warning that tells people to start using db instead of connection. Release version as a minor release, or patch level release?

Phase 2: Merge this PR into master with the idea of releasing it in v2.0.

Thoughts?

@botandrose
Copy link
Contributor Author

@etagwerker yes, I agree 100%. I'm imagining v1.99 to be that interim release that supports both :connection (and :model) and :db, with a deprecation warning telling folks to just use :db. I'm going to branch v1.99 off of the v1-maintenance branch, so master is already v2.0, so I think this should be good to merge, even before v1.99 is released. Sound good to you?

@botandrose botandrose merged commit 7656f1d into master May 30, 2020
@botandrose botandrose deleted the rename_connection_to_db branch May 30, 2020 15:36
dsantosmerino added a commit to Badiapp/database_cleaner-active_record that referenced this pull request Jan 27, 2021
It was changed in the main repo some months ago: DatabaseCleaner/database_cleaner#650.
botandrose pushed a commit to DatabaseCleaner/database_cleaner-active_record that referenced this pull request Jan 31, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
It was changed in the main repo some months ago: DatabaseCleaner/database_cleaner#650.
botandrose pushed a commit to DatabaseCleaner/database_cleaner-sequel that referenced this pull request Feb 1, 2021
nTraum added a commit to CitizenLabDotCo/citizenlab that referenced this pull request Dec 1, 2021
The library is now splitted into multiple gems, depending on the ORM / database you use.

Changes since 1.7.0:

```
== 2.0.1 2021-02-04

== Bugfixes
  * Regression: allow_remote_database_url and url_allowlist not working anymore: DatabaseCleaner/database_cleaner#671

== 2.0.0 2021-01-31

=== Changes
  * Rename `url_whitelist` to `url_allowlist`
  * Allowlist now supports regular expressions
  * Fixed Ruby 2.7 deprecation warnings

=== Breaking changes
  * Failed checks against the allowlist now raise `UrlNotAllowed` rather than `NotWhitelistedUrl`

== 2.0.0.beta2 2020-05-30

=== Features
  * New API for ORM Adapter gems: DatabaseCleaner/database_cleaner#644

=== Breaking changes
  * Rename :connection configuration option to :db for consistency: DatabaseCleaner/database_cleaner#650
  * Remove all #orm= setter methods: https://github.com/DatabaseCleaner/database_cleaner/pull/643/files
  * drop support for Ruby 2.4 which is EOL as of 2020-03-31: DatabaseCleaner/database_cleaner#635

== 2.0.0.beta 2020-04-05

=== Breaking changes
  * Replace old shared RSpec examples with new "database_cleaner adapter" example: DatabaseCleaner/database_cleaner#629
  * split gem into database_cleaner-core and database_cleaner metagem.
  * Support Ruby versions 2.4, 2.5, 2.6, and 2.7, and drop support for older Rubies.
  * remove all deprecated code and get the specs passing again.
  * Split off all adapter gems into their own repos: DatabaseCleaner/database_cleaner#620

== 1.99.0 2021-01-31

== Changes
  * Remove unnecessary dependency on database_cleaner-mongo from database_cleaner-mongoid: @botandrose
  * Enable the :cache_tables option for the mongo truncation strategy, and default to true: DatabaseCleaner/database_cleaner#646"
  * Introduce deletion aliases for truncation strategies for mongo, mongoid, and redis adapters. DatabaseCleaner/database_cleaner#654
  * Add new :db orm configuration key, for consistency with #db and #db=. DatabaseCleaner/database_cleaner#649

== Deprecations
  * Deprecate all #orm= setter methods: DatabaseCleaner/database_cleaner#643
  * Deprecate non-functional :reset_ids option in ActiveRecord truncation strategy: DatabaseCleaner/database_cleaner#559
  * Deprecate mongo truncation's `:cache_tables => true` option in favor of `false`, to prep for caching removal in v2.0: DatabaseCleaner/database_cleaner#646"
  * Deprecate redis truncation's #url method in favor of #db: @botandrose
  * Deprecate mongo, mongoid, and redis truncation strategies in favor of deletion. DatabaseCleaner/database_cleaner#654
  * Deprecate :connection and :model configuration options in favor of :db for consistency: DatabaseCleaner/database_cleaner#650

== Bugfixes
  * Fix deprecation warning about `DatabaseCleaner.connections` to recommend a better alternative: DatabaseCleaner/database_cleaner#656

== 1.8.5 2020-05-04

=== Bug Fixes
  * Fix :mongo strategy: DatabaseCleaner/database_cleaner#645

== 1.8.4 2020-04-02

=== Bug Fixes
  * Fix false positive deprecation warnings on Windows: DatabaseCleaner/database_cleaner#633

== 1.8.3 2020-02-18

=== Bug Fixes
  * Fix performance issue of DatabaseCleaner::Base#orm_module: DatabaseCleaner/database_cleaner#625

== 1.8.2 2020-02-01

=== Bug Fixes
  * Fix database_cleaner-ohm autodetected adapter loading: DatabaseCleaner/database_cleaner#619
  * Fix database_cleaner-mongo_mapper autodetected adapter loading: @botandrose
  * Fix database_cleaner-mongoid autodetected adapter loading: DatabaseCleaner/database_cleaner#617
  * Exclude ar_internal_metadata from truncation on Rails 5: DatabaseCleaner/database_cleaner#588

=== Changes
  * Deprecate ohm adapter: DatabaseCleaner/database_cleaner#619

== 1.8.1 2020-01-30

=== Bug Fixes
  * Remove undeclared active_support dependency: DatabaseCleaner/database_cleaner#612

== 1.8.0 2020-01-29

=== Bug Fixes
  * Fix MySQL deprecation warnings with Rails 5: DatabaseCleaner/database_cleaner#574
  * Fix MySQL truncation with `pre_count: true`: DatabaseCleaner/database_cleaner#498
  * Fix primary key sequence resetting in Sequel with Postgres and SQLite: https://github.com/DatabaseCleaner/database_cleaner/pull/538/files
  * ActiveRecord truncation adapter doesn't work with Oracle: DatabaseCleaner/database_cleaner#542

=== Changes
  * Extract ORM adapters into gems: DatabaseCleaner/database_cleaner#560
  * Allow postgres:///dbname as a local url: DatabaseCleaner/database_cleaner#569
  * Add an optional URL whitelist safeguard: DatabaseCleaner/database_cleaner#526
  * Add `local` tld to safeguard check: DatabaseCleaner/database_cleaner#547
  * Speed up ActiveRecord deletion strategy: DatabaseCleaner/database_cleaner#534
  * Consider `sqlite:` database urls to be local: DatabaseCleaner/database_cleaner#529
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

:connection vs #db confusion. Let's pick one!
3 participants