dspjm
dspjm

Reputation: 5840

Django: How to dump the database in 1.8?

I used to use manage.py sqlall app to dump the database to sql statements. While, after upgrading to 1.8, it doesn't work any more.

It says:

CommandError: App 'app' has migrations. Only the sqlmigrate and sqlflush commands can be used when an app has migrations.

It seems there is not a way to solve this.

I need to dump the database to sql file, so I can use it to clone the whole database else where, how can I accomplish this?

Upvotes: 1

Views: 334

Answers (2)

Abhishek
Abhishek

Reputation: 3068

Try the following:

python manage.py dumpdata <app_name> > <outputfile>

Upvotes: 1

David G
David G

Reputation: 318

You can dump the db directly with mysqldump as allcaps suggested, or run manage.py migrate first and then it should work. It's telling you there are migrations that you have yet to apply to the DB.

Upvotes: 1

Related Questions