Custom config path improvements
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 4.5k
- Forks
- 884
- PR merge metrics
- No merged PRs in 30d
Description
Although Phinx purportedly supports moving the config file out of the project root directory, it does not seem to be designed in a way that actually accommodates such usage, due to a number of pain points.
Some commands require the config file and some do not, which means some commands support the --configuration option and some do not. This is fine when the app automatically detects the config as and when required, but when it needs to be specified, is problematic because if it is specified when it is not required, a fatal error is thrown. Consider a wrapper script that passes the --configuration option: it does not know whether to pass the configuration option or not unless it does its own parsing of the command line and cross-references it with its own database of commands that require it. It should be considered common to write such a wrapper because we don't want to manually specify the path on every invocation.
Here are my suggestions:
1a. Either support --configuration on all commands, even ones that do not require it (silently ignoring when not needed), or:
1b. Add an environment variable that should point to the configuration path and be read as needed.
2. The configuration path should be valid as just a path rather than an absolute file location. When it is just a path, the same config file lookup rules should be applied as they are to the default location. e.g. -c db will find db/phinx.php. PHPUnit works this way.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by reviewing which commands accept --configuration and how the default config lookup works; done means a wrapper can consistently provide configuration and a path such as db resolves according to the normal lookup rules.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100