cli
cli copied to clipboard
feat: added db:info command
Pull Request check-list
Please make sure to review and check all of these items:
- [x] Does
npm run testpass with this change (including linting)? - [ ] Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
- [ ] Have you added new tests to prevent regressions?
- [ ] Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
Description of change
Adds the db:info command which displays the config information.
Thanks for the PR! I haven't had the time to take a look at this yet, but I haven't forgotten about it
As further context, before I have to search for it again in Slack;
This PR was first opened as #931
Suggestions from Slack, not very relevant
- A suggestion was made there to 'make the output a little prettier' - There the suggestion was made to log it line by line instead of logging the object itself.// Your example
Config {
username: 'root',
password: '***',
database: 'test_database',
host: 'localhost',
port: '3306',
dialect: 'mysql'
}
// Suggestion
Sequelize configuration:
username: root
password: ***
database: test_database
host: localhost
port: 3306
dialect: mysql
- An additional suggestion on Slack was to add a
--rawflag so the output would still be the object - A note added there was that the configuration can have nested objects and that those should work with this as well. A proposal for that was;
define.underscored: true
some.other.nested.value: value here
-
The config used for the CLI tests would probably be used to test this new feature since it also has nested objects.
-
Additionally a
--show-passwordflag was proposed to show the password.
The tests that should be added here should use simplified versions of the test config and check the output is as expected. Suggested tests are;
- With a very basic config, verify that the output by using the command is correct
- With a very basic config, verify that the output by using the
--rawflag is correct - With a config with nesting, verify that the output by using the command is correct
- With a config with nesting, verify that the output by using the
--rawflag is correct - With a very basic config, verify that the output by using the
--show-passwordflag is correct
These tests can be based on https://github.com/sequelize/cli/blob/main/test/version.test.js One test that specifies a different config location that can be used is https://github.com/sequelize/cli/blob/main/test/options.test.js#L50-L66 Seeing that most/all tests should be run on both configs, something like the following could be useful to keep in mind; https://github.com/sequelize/cli/blob/main/test/db/seed/all.test.js#L7-L17
@reilg do you think you can work on this further with this information?