Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clarification on django syncdb --all option

I am trying to understand what exactly ./manage.py syncdb --all does? I recently had a database issue that I was able to fix by running this command but I am not exactly sure what it does behind the scenes. I understand that syncdb creates the tables for the installed apps that aren't being migrated with south and that those that are under south migration control are overlooked unless the --all option is specified but I am confused by what actually happens and when to use it. I am unable to find anything about the option on the django-admin docs and the man pages only say this about the option.

--all                 Makes syncdb work on all apps, even migrated ones. Be
                        careful!

Why do I need to be careful? What exactly is this doing? Is it completely deleting the database and starting over, which I assume would cause me to lose all of my data stored in the database (right?), or is something else happening here? I am using Django 1.6 if that makes a difference.

like image 612
user3282276 Avatar asked Feb 16 '26 12:02

user3282276


1 Answers

When you install south, it replaces Django's syncdb command with its own. It is the south version of syncdb that has the --all option, but its not recommended:

If you want to run syncdb on all of the apps, then use --all, but be warned; this will put your database schema and migrations out of sync. If you do this, you might be able to fix it with:

The syncdb command never deletes tables. You need to be careful because you don't want the database schema and migrations to get out of sync.

like image 64
Alasdair Avatar answered Feb 19 '26 01:02

Alasdair



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!