Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django flush vs sqlclear & syncdb

Tags:

Can anyone tell if there is a difference between

>manage.py flush  # or reset

and

>manage.py sqlclear appname | python manage.py dbshell
>manage.py syncdb 
like image 793
Jibin Avatar asked Sep 29 '11 13:09

Jibin


People also ask

What is Sqlmigrate?

makemigrations : It is used to create a migration file that contains code for the tabled schema of a model. migrate : It creates table according to the schema defined in the migration file. sqlmigrate : It is used to show a raw SQL query of the applied migration.

What is admin in Django?

One of the most powerful parts of Django is the automatic admin interface. It reads metadata from your models to provide a quick, model-centric interface where trusted users can manage content on your site. The admin's recommended use is limited to an organization's internal management tool.


1 Answers

flush will truncate (delete data)

sqlclear will drop (delete table, thus data too)

=> if you have structural modifications in your db, you have to do sqlclear (but better use south)

Update:

South has been deprecated.

From Django 1.7 upwards, migrations are built into the core of Django. If you are running a previous version, you can use South.

like image 59
lajarre Avatar answered Oct 05 '22 00:10

lajarre