AthennaIO / AthennaIO/Database

[Feature]: Add force flag in commands

Open
#3 3 comments 0 reactions 3 assignees Assigned to @txsoura View on GitHub
feature good first issue
Dominant language
TypeScript
Stars
7
Forks
1
Avg merge
1m
Merged PRs (30d)
2

Description

### 🚀 Feature Proposal

Commands that affect saved data, should be ignored in the production environment if it has no `force` flag.

The run/revert migration commands and database wipe command, should not be easily run in production, these commands could be found at the above paths of the project:

- [DbWipe](https://github.com/AthennaIO/Database/blob/develop/src/Commands/Db/Wipe.js)
- [MigrationRun](https://github.com/AthennaIO/Database/blob/develop/src/Commands/Migration/Run.js)
- [MigrationRevert](https://github.com/AthennaIO/Database/blob/develop/src/Commands/Migration/Revert.js)

### Motivation

To prevent production data lost.

### Example

If `NODE_ENV=production`, the above command should throw an exception with an explanation to the developer that he needs to use `--force` flag to run this command in production:

```js
node artisan migration:run
```

If `NODE_ENV=production`, the above command should work as expected:

```js
node artisan migration:run --force
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.