-
Notifications
You must be signed in to change notification settings - Fork 15
Description
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:
-
When we run this command
npm run reset:dbwe should show a prompt likeAre 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
yesand pressEnterto 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 ofcodershowco*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 ofmysecretpasswordshowm**************d.
- A user should type
-
We also have to be able to run the command
npm run reset:dbusing 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 likenpm run reset:db -- --yes. If the command run this way:- don't ask for confirmation