django / django/new-features

Make destructive commands such as migrate/createcachetable interactive by default to prevent accidental executions

Open
#167 7 comments 2 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
188
Forks
7
PR merge metrics
No merged PRs in 30d

Description

### Code of Conduct

- [x] I agree to follow Django's Code of Conduct

### Feature Description

User confirmation prompt for desctructive commands `migrate` and `createcachetable`, which can be bypassed using `-no--input` flag

### Problem

```python
python manage.py migrate
```
is a subset of
```python
python manage.py migrate --plan
```
A preview command is walking into destructive territory which has no safety rails, accidentaly execution can lead to unnecessarily painful experience. Not to mention explicit consent/cofirmation is a UX for destructive commands in place which some of the management commands already follow.

### Request or proposal

proposal

### Additional Details

This proposal is evolved from initial discussion, here's more information https://github.com/django/new-features/issues/163

Note: flush/collectstatic already follow proposed pattern

### Implementation Suggestions

User executes:

```python
python manage.py migrate
```
Prompted with: "This command can modify database. Are you sure you want to proceed ? [Y/N]

User executes:
```python
python manage.py migrate -no--input
```

_Migration is applied_

Similar pattern will be followed for `createcachetable`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.