Model changes in Django

I made a mistake in the database definition When I changed DateField in Models.py to DurationField, an error occurred. So I took the method of recreating the database from scratch. Note. Be careful as the created User and other tables will also disappear. Note 2. There must be a way to change the database on Django, so use that if you can.

What i did

  1. Erase all migration files
  2. Delete database

Delete migration file

The file structure is as follows.

$ls
 -project -app -migrations
               Lviews.py etc.
          Lmanage.py
          Lconfig - settings.py etc.
$cd [Path to app]
$rm -d -r migrations/

Delete database

Delete sqlite file for sqlite I was using PostgreSQL, so I deleted the database directly from PdAdmin4 and recreated the database with the same name.

Recommended Posts

Model changes in Django
Django model: ManyToManyField
Models in Django
Forms in Django
Django: Migration doesn't reflect model in DB
Implement a Custom User Model in Django
High Performance Django --Model
How to get multiple model objects randomly in Django
Performance optimization in Django 3.xx
Visualize Keras model in Python 3.5
PHP var_dump in Django templates
Handle constants in Django templates
Implement follow functionality in Django
Rename table columns in Django3
Use django model from interpreter
(Note) Django in Vagrant environment
Changes in coronavirus infection rate
Show Django ManyToManyField in Template
[Django] Manage settings like writing in settings.py with a model
Create an easy-to-use follow model in Django using ManyToManyField through
reload in django shell with ipython
Set placeholders in input fields in Django
8 Frequently Used Commands in Python Django
Dynamically add form fields in Django
Implementation of login function in Django
Register your Django application in your project
Assignments and changes in Python objects
Automatically generate model relationships with Django
Write foreign key constraints in Django
How to reflect CSS in Django
Switch the language displayed in Django 1.9
Get parameter values ​​in Django templates
General Gaussian state-space model in Python
The meaning of ".object" in Django
Deploy Django in 3 minutes using docker-compose
Pin factory_boy seed value in Django
GraphQL API with graphene_django in Django
Like button implementation in Django + Ajax
Get the query string (query string) in Django
Custom state space model in Python
Create a LINE Bot in Django
Implementation of custom user model authentication in Django REST Framework with djoser
Install Django in a pipenv virtual environment
Get the client's IP address in Django
When you can't call base.html in Django
DJango Memo: From the beginning (model settings)
WEB application development using Django [Model definition]
Logical deletion in Django, DRF (Django REST Framework)
What's new in Django 1.8 Conditional Expressions #djangoja
Django ~ Let's display it in the browser ~
Information recording memo using session in Django
How to delete expired sessions in Django
CSS environment created in 10 minutes using Django
Use a scikit-learn model trained in PySpark
Create a model for your Django schedule
Notes on creating static files in Django
(Note) Template file search order in Django
Dynamically specify a ModelChoiceField queryset in Django
Get query parameters for GET requests in Django
Ajax in Django (using generic class view)
Django Foreign Key Tutorial Ends in 10 Minutes