Skip to content

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

Open
@maxceem

Description

@maxceem

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions