# Django Migrations
### dbshell
```bash
$ python manage.py dbshell
```
- For PostgreSQL, this runs the psql command-line client.
- For MySQL, this runs the mysql command-line client.
- For SQLite, this runs the sqlite3 command-line client.
- For Oracle, this runs the sqlplus command-line client.
### Listing Out Migrations
```bash
$ ./manage.py showmigrations
```
### Naming Migrations
```bash
$ ./manage.py makemigrations historical_data --name 0002_switch_to_decimals
```
## You want to clear all the migration history but you want to keep the existing database.
### 1. Make sure your models fits the current database schema
```bash
$ python manage.py makemigrations
```
*If there are any pending migration, apply them first.*
### 2. Clear the migration history for each app
```bash
$ python manage.py showmigrations
$ python manage.py migrate --fake core zero
```
*Clear the migration history (please note that core is the name of my app)*
### 3. Remove the actual migration files.
### 4. Create the initial migrations
```bash
$ python manage.py makemigrations
```
### 5. Fake the initial migration
```bash
$ python manage.py migrate --fake-initial
```
https://simpleisbetterthancomplex.com/tutorial/2016/07/26/how-to-reset-migrations.html