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

Add confirm prompt for "npm run reset:db" #163

Open
maxceem opened this issue Nov 14, 2019 · 0 comments
Open

Add confirm prompt for "npm run reset:db" #163

maxceem opened this issue Nov 14, 2019 · 0 comments

Comments

@maxceem
Copy link
Contributor

maxceem commented Nov 14, 2019

A command npm run reset:db to recreate DB schema has been added, so we don't need to uncomment code here or here during local development to create a DB schema.

Though there is a risk of running this command in the production environment. To make it safer we can do the next thing:

  1. When we run this command npm run reset:db we should show a prompt like Are you sure you want to recreate the DB "<DB_NAME>" schema on "<DB_HOST>" by user "<DB_USER_WITH_STARS>" and password "<DB_PASSWORD_WITH_STARS>"? This would REMOVE all existent data if any.

    • A user should type yes and press Enter to confirm. Typing anything else should cancel the command.
    • <DB_USER_WITH_STARS> should show the user, but only first 2 and last 2 characters visible, the rest are replaced by *. For example, instead of coder show co*er.
    • <DB_PASSOWRD_WITH_STARS> should show the password, but only first 1 and last 1 characters visible, the rest are replaced by *. For example, instead of mysecretpassword show m**************d.
  2. We also have to be able to run the command npm run reset:db using scripts automatically without the participation of a human. For such cases, we have to support an optional argument --yes, so the command could be run like npm run reset:db -- --yes. If the command run this way:

    • don't ask for confirmation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant