rails icon indicating copy to clipboard operation
rails copied to clipboard

Move dbconsole logic to Active Record connection adapter.

Open gmcgibbon opened this issue 1 year ago • 0 comments

This Pull Request has been created because the dbconsole command is doing too much. It makes it impossible for adapters to configure dbconsole behaviour without patching it in the command directly.

Detail

Instead of hosting the connection logic in the command object, the database adapter should be responsible for connecting to a console session.

Additional information

This patch moves #find_cmd_and_exec to the adapter and exposes a new API to lookup the adapter class without instantiating it.

Since we also are effectively dropping first party dbconsole support for oracle and sqlserver adapters, we will be submitting patches to implement and test this in those adapters. The jdbc mysql and postgis adapters are subclassed to inherit this behaviour.

Checklist

Before submitting the PR make sure the following are checked:

  • [x] This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • [x] There are no typos in commit messages and comments.
  • [x] Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • [x] Feature branch is up-to-date with main (if not - rebase it).
  • [x] Pull request only contains one commit for bug fixes and small features. If it's a larger feature, multiple commits are permitted but must be descriptive.
  • [x] Tests are added if you fix a bug or add a feature.
  • [x] CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.
  • [x] PR is not in a draft state.
  • [ ] CI is passing.

gmcgibbon avatar Sep 21 '22 22:09 gmcgibbon